You are here

public function RulesTest::testGetAllPagination in Auth0 Single Sign On 8.2

Test that getAll method respects pagination.

Return value

void

Throws

\Exception Thrown by the HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/tests/API/Management/RulesTest.php, line 131

Class

RulesTest
Class RulesTest.

Namespace

Auth0\Tests\API\Management

Code

public function testGetAllPagination() {
  $api = new Management(self::$env['API_TOKEN'], self::$env['DOMAIN']);
  $paged_results = $api
    ->rules()
    ->getAll(null, null, null, 0, 2);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertCount(2, $paged_results);

  // Second page of 1 result.
  $paged_results_2 = $api
    ->rules()
    ->getAll(null, null, null, 1, 1);
  usleep(AUTH0_PHP_TEST_INTEGRATION_SLEEP);
  $this
    ->assertCount(1, $paged_results_2);
  $this
    ->assertEquals($paged_results[1]['id'], $paged_results_2[0]['id']);
}