function SessionConfigurationTest::testSameSiteCookie

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Session/SessionConfigurationTest.php \Drupal\Tests\Core\Session\SessionConfigurationTest::testSameSiteCookie()

Test that session.cookie_samesite is configured correctly.

File

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

Class

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

Namespace

Drupal\Tests\Core\Session

Code

public function testSameSiteCookie() : void {
    $request = Request::create('https://example.com');
    $config = $this->createSessionConfiguration([
        'cookie_samesite' => 'Strict',
    ]);
    $options = $config->getOptions($request);
    $this->assertEquals('Strict', $options['cookie_samesite']);
}

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