You are here

public function LogsTest::testLogSearchPagination in Auth0 Single Sign On 8.2

Test pagination parameters.

Return value

void

File

vendor/auth0/auth0-php/tests/API/Management/LogsTest.php, line 78

Class

LogsTest
Class LogsTest. Tests the Auth0\SDK\API\Management\Logs class.

Namespace

Auth0\Tests\API

Code

public function testLogSearchPagination() {
  $expected_count = 5;
  $search_results = self::$api
    ->search([
    // Fields here to speed up API call.
    'fields' => '_id,log_id',
    'include_fields' => true,
    // Second page of 5 results.
    'page' => 1,
    'per_page' => $expected_count,
    // Include totals to check pagination.
    'include_totals' => true,
  ]);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertCount($expected_count, $search_results['logs']);
  $this
    ->assertEquals($expected_count, $search_results['length']);

  // Starting on 2nd page so starting result should be equal to the number per page.
  $this
    ->assertEquals($expected_count, $search_results['start']);
}