mirror of
https://github.com/buddypress/buddypress.git
synced 2026-07-21 20:54:17 +08:00
See #7620. git-svn-id: https://buddypress.svn.wordpress.org/trunk@11737 cdf35c40-ae34-48e0-9cc9-0c9da1808c22
41 lines
971 B
PHP
41 lines
971 B
PHP
<?php
|
|
|
|
/**
|
|
* @group notifications
|
|
* @group template
|
|
*/
|
|
|
|
class BP_Tests_Notifications_BPNotificationsTemplate extends BP_UnitTestCase {
|
|
/**
|
|
* @group pagination
|
|
* @group BP6229
|
|
*/
|
|
public function test_pagination_params_in_url_should_be_passed_to_query() {
|
|
$u = self::factory()->user->create();
|
|
|
|
$notifications = array();
|
|
for ( $i = 1; $i <= 6; $i++ ) {
|
|
$notifications[] = self::factory()->notification->create( array(
|
|
'component_name' => 'activity',
|
|
'secondary_item_id' => $i,
|
|
'user_id' => $u,
|
|
'is_new' => true,
|
|
) );
|
|
}
|
|
|
|
$_REQUEST['npage'] = 2;
|
|
|
|
$template = new BP_Notifications_Template( array(
|
|
'user_id' => $u,
|
|
'is_new' => true,
|
|
'per_page' => 2,
|
|
'order_by' => 'id',
|
|
) );
|
|
|
|
unset( $_REQUEST['npage'] );
|
|
|
|
// Check that the correct number of items are pulled up
|
|
$expected = array( $notifications[3], $notifications[2] );
|
|
$this->assertEquals( $expected, wp_list_pluck( $template->notifications, 'id' ) );
|
|
}
|
|
}
|