You are here

public function RolesTestMocked::testThatGetAllRolesRequestIsFormattedProperly in Auth0 Single Sign On 8.2

Test a basic getAll roles call.

Return value

void

Throws

\Exception Should not be thrown in this test.

File

vendor/auth0/auth0-php/tests/API/Management/RolesMockedTest.php, line 61

Class

RolesTestMocked
Class RolesTestMocked.

Namespace

Auth0\Tests\API\Management

Code

public function testThatGetAllRolesRequestIsFormattedProperly() {
  $api = new MockManagementApi([
    new Response(200, self::$headers),
  ]);
  $api
    ->call()
    ->roles()
    ->getAll([
    'name_filter' => '__test_name_filter__',
    'page' => 2,
  ]);
  $this
    ->assertEquals('GET', $api
    ->getHistoryMethod());
  $this
    ->assertStringStartsWith('https://api.test.local/api/v2/roles', $api
    ->getHistoryUrl());
  $query = $api
    ->getHistoryQuery();
  $this
    ->assertContains('page=2', $query);
  $this
    ->assertContains('name_filter=__test_name_filter__', $query);
  $headers = $api
    ->getHistoryHeaders();
  $this
    ->assertEquals('Bearer __api_token__', $headers['Authorization'][0]);
  $this
    ->assertEquals(self::$expectedTelemetry, $headers['Auth0-Client'][0]);
}