function SessionConfigurationTest::testEnforcedCookieDomain

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testEnforcedCookieDomain()
  2. 10 core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testEnforcedCookieDomain()
  3. 9 core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testEnforcedCookieDomain()
  4. 8.9.x core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testEnforcedCookieDomain()

Tests the constructor injected session.cookie_domain ini setting.

@legacy-covers ::__construct @legacy-covers ::getOptions

Attributes

#[DataProvider('providerTestEnforcedCookieDomain')]

File

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

Class

SessionConfigurationTest
Tests Drupal\Core\Session\SessionConfiguration.

Namespace

Drupal\Tests\Core\Session

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.