Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/01/2015 01:34:15 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Notifications: Ensure pagination works with $_GET parameters.

Props boonebgorges. See #6229. (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/notifications/class-bp-notifications-notification.php

    r9139 r9570  
    280280        $this->assertEquals( $expected, $actual );
    281281    }
     282
     283    /**
     284     * @group pagination
     285     * @group BP6229
     286     */
     287    public function test_get_paged_sql() {
     288        $u = $this->factory->user->create();
     289
     290        $notifications = array();
     291        for ( $i = 1; $i <= 6; $i++ ) {
     292            $notifications[] = $this->factory->notification->create( array(
     293                'component_name' => 'activity',
     294                'secondary_item_id' => $i,
     295                'user_id' => $u,
     296                'is_new' => true,
     297            ) );
     298        }
     299
     300        $found = BP_Notifications_Notification::get( array(
     301            'user_id' => $u,
     302            'is_new' => true,
     303            'page' => 2,
     304            'per_page' => 2,
     305            'order_by' => 'id',
     306        ) );
     307
     308        // Check that the correct number of items are pulled up
     309        $expected = array( $notifications[2], $notifications[3] );
     310        $this->assertEquals( $expected, wp_list_pluck( $found, 'id' ) );
     311    }
    282312}
Note: See TracChangeset for help on using the changeset viewer.