You are here

public function InformationHeadersTest::testThatSetEnvironmentSetsDataCorrectly in Auth0 Single Sign On 8.2

Set and override an env property with the deprecated method and make sure it's returned correctly.

Return value

void

File

vendor/auth0/auth0-php/tests/API/Helpers/InformationHeadersTest.php, line 63

Class

InformationHeadersTest
Class InformationHeadersTest

Namespace

Auth0\Tests\Api\Helpers

Code

public function testThatSetEnvironmentSetsDataCorrectly() {
  $header = new InformationHeaders();
  $header
    ->setEnvironment('test_env_name', '2.3.4');
  $header_data = $header
    ->get();
  $this
    ->assertArrayHasKey('env', $header_data);
  $this
    ->assertCount(1, $header_data['env']);
  $this
    ->assertArrayHasKey('test_env_name', $header_data['env']);
  $this
    ->assertEquals('2.3.4', $header_data['env']['test_env_name']);
  $header
    ->setEnvironment('test_env_name', '3.4.5');
  $header_data = $header
    ->get();
  $this
    ->assertEquals('3.4.5', $header_data['env']['test_env_name']);
  $header
    ->setEnvironment('test_env_name_2', '4.5.6');
  $header_data = $header
    ->get();
  $this
    ->assertEquals('4.5.6', $header_data['env']['test_env_name_2']);
}