You are here

public function SessionConfigurationTest::testEnforcedCookieDomain in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testEnforcedCookieDomain()

Tests the constructor injected session.cookie_domain ini setting.

@covers ::__construct @covers ::getOptions

@dataProvider providerTestEnforcedCookieDomain

File

core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php, line 72

Class

SessionConfigurationTest
@coversDefaultClass \Drupal\Core\Session\SessionConfiguration @group Session

Namespace

Drupal\Tests\Core\Session

Code

public function testEnforcedCookieDomain($uri, $expected_domain) {
  $config = $this
    ->createSessionConfiguration([
    'cookie_domain' => '.example.com',
  ]);
  $request = Request::create($uri);
  $options = $config
    ->getOptions($request);
  $this
    ->assertEquals($expected_domain, $options['cookie_domain']);
}