You are here

public function BlacklistsTest::testThatBlacklistRequestIsFormedProperly in Auth0 Single Sign On 8.2

Throws

\Exception Should not be thrown in this test.

File

vendor/auth0/auth0-php/tests/API/Management/BlacklistsTest.php, line 58

Class

BlacklistsTest

Namespace

Auth0\Tests\API\Management

Code

public function testThatBlacklistRequestIsFormedProperly() {
  $api = new MockManagementApi([
    new Response(200, self::$headers),
  ]);
  $api
    ->call()
    ->blacklists()
    ->blacklist('__test_aud__', '__test_jti__');
  $this
    ->assertEquals('POST', $api
    ->getHistoryMethod());
  $this
    ->assertEquals('https://api.test.local/api/v2/blacklists/tokens', $api
    ->getHistoryUrl());
  $this
    ->assertEmpty($api
    ->getHistoryQuery());
  $body = $api
    ->getHistoryBody();
  $this
    ->assertArrayHasKey('aud', $body);
  $this
    ->assertEquals('__test_aud__', $body['aud']);
  $this
    ->assertArrayHasKey('jti', $body);
  $this
    ->assertEquals('__test_jti__', $body['jti']);
  $headers = $api
    ->getHistoryHeaders();
  $this
    ->assertEquals('Bearer __api_token__', $headers['Authorization'][0]);
  $this
    ->assertEquals(self::$expectedTelemetry, $headers['Auth0-Client'][0]);
  $this
    ->assertEquals('application/json', $headers['Content-Type'][0]);
}