You are here

public function ClientsTest::testThatGetAllRequestWithParamsIsFormedProperly in Auth0 Single Sign On 8.2

Throws

\Exception

File

vendor/auth0/auth0-php/tests/API/Management/ClientsTest.php, line 71

Class

ClientsTest
Class ClientsTest

Namespace

Auth0\Tests\API\Management

Code

public function testThatGetAllRequestWithParamsIsFormedProperly() {
  $api = new MockManagementApi([
    new Response(200, self::$headers),
  ]);
  $api
    ->call()
    ->clients()
    ->getAll([
    'field1',
    'field2',
  ], false, 1, 5, [
    'include_totals' => true,
  ]);
  $this
    ->assertEquals('GET', $api
    ->getHistoryMethod());
  $this
    ->assertStringStartsWith('https://api.test.local/api/v2/clients', $api
    ->getHistoryUrl());
  $query = '&' . $api
    ->getHistoryQuery();
  $this
    ->assertContains('&fields=field1,field2', $query);
  $this
    ->assertContains('&include_fields=false', $query);
  $this
    ->assertContains('&page=1', $query);
  $this
    ->assertContains('&per_page=5', $query);
  $this
    ->assertContains('&include_totals=true', $query);
  $headers = $api
    ->getHistoryHeaders();
  $this
    ->assertEquals('Bearer __api_token__', $headers['Authorization'][0]);
  $this
    ->assertEquals(self::$expectedTelemetry, $headers['Auth0-Client'][0]);
}