You are here

public function InformationHeadersExtendTest::testThatExtendedHeadersBuildCorrectly in Auth0 Single Sign On 8.2

Extend existing headers and make sure existing data stays intact.

@link https://github.com/auth0/jwt-auth-bundle/blob/master/src/JWTAuthBundle.php @link https://github.com/auth0/laravel-auth0/blob/master/src/Auth0/Login/Login...

Return value

void

File

vendor/auth0/auth0-php/tests/API/Helpers/InformationHeadersExtendTest.php, line 34

Class

InformationHeadersExtendTest
Class InformationHeadersExtendTest

Namespace

Auth0\Tests\Api\Helpers

Code

public function testThatExtendedHeadersBuildCorrectly() {
  $new_headers = self::setExtendedHeaders('test-extend-sdk-1', '1.2.3');
  $new_headers
    ->setEnvironment('test-extend-env', '2.3.4');
  $new_header_data = $new_headers
    ->get();

  // Look for new SDK name and version.
  $this
    ->assertEquals('test-extend-sdk-1', $new_header_data['name']);
  $this
    ->assertEquals('1.2.3', $new_header_data['version']);

  // Look for original env data.
  $this
    ->assertArrayHasKey('env', $new_header_data);
  $this
    ->assertArrayHasKey('php', $new_header_data['env']);
  $this
    ->assertEquals(phpversion(), $new_header_data['env']['php']);
  $this
    ->assertArrayHasKey('auth0-php', $new_header_data['env']);
  $this
    ->assertEquals(ApiClient::API_VERSION, $new_header_data['env']['auth0-php']);

  // Look for extended env data.
  $this
    ->assertArrayHasKey('test-extend-env', $new_header_data['env']);
  $this
    ->assertEquals('2.3.4', $new_header_data['env']['test-extend-env']);
}