[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/tests/phpunit/testcases/notifications/ -> class-bp-notifications-template.php (source)

   1  <?php
   2  
   3  /**
   4   * @group notifications
   5   * @group template
   6   */
   7  
   8  class BP_Tests_Notifications_BPNotificationsTemplate extends BP_UnitTestCase {
   9      /**
  10       * @group pagination
  11       * @group BP6229
  12       */
  13      public function test_pagination_params_in_url_should_be_passed_to_query() {
  14          $u = self::factory()->user->create();
  15  
  16          $notifications = array();
  17          for ( $i = 1; $i <= 6; $i++ ) {
  18              $notifications[] = self::factory()->notification->create( array(
  19                  'component_name' => 'activity',
  20                  'secondary_item_id' => $i,
  21                  'user_id' => $u,
  22                  'is_new' => true,
  23              ) );
  24          }
  25  
  26          $_REQUEST['npage'] = 2;
  27  
  28          $template = new BP_Notifications_Template( array(
  29              'user_id' => $u,
  30              'is_new' => true,
  31              'per_page' => 2,
  32              'order_by' => 'id',
  33          ) );
  34  
  35          unset( $_REQUEST['npage'] );
  36  
  37          // Check that the correct number of items are pulled up
  38          $expected = array( $notifications[3], $notifications[2] );
  39          $this->assertEquals( $expected, wp_list_pluck( $template->notifications, 'id' ) );
  40      }
  41  }


Generated: Sun Dec 22 01:00:54 2024 Cross-referenced by PHPXref 0.7.1