You are here

public function Auth0Test::testThatGetLoginUrlGeneratesState in Auth0 Single Sign On 8.2

File

vendor/auth0/auth0-php/tests/Auth0Test.php, line 368

Class

Auth0Test
Class Auth0Test

Namespace

Auth0\Tests

Code

public function testThatGetLoginUrlGeneratesState() {
  $custom_config = self::$baseConfig;
  unset($custom_config['state_handler']);
  $auth0 = new Auth0($custom_config);

  // Ignore cookie error triggered when session is started.
  // phpcs:ignore
  $auth_url = @$auth0
    ->getLoginUrl();
  $parsed_url_query = parse_url($auth_url, PHP_URL_QUERY);
  $url_query = explode('&', $parsed_url_query);
  $this
    ->assertContains('state=' . $_SESSION['auth0__webauth_state'], $url_query);
}