function SessionTestCase::testSameSiteCookieAttributeStrict in Drupal 7
Test SameSite attribute = Strict on session cookies.
File
- modules/
simpletest/ tests/ session.test, line 318 - Provides SimpleTests for core session handling functionality.
Class
- SessionTestCase
- @file Provides SimpleTests for core session handling functionality.
Code
function testSameSiteCookieAttributeStrict() {
variable_set('samesite_cookie_value', 'Strict');
$user = $this
->drupalCreateUser(array(
'access content',
));
$this
->sessionReset($user->uid);
$this
->drupalLogin($user);
$this
->assertTrue(preg_match('/SameSite=Strict/i', $this
->drupalGetHeader('Set-Cookie', TRUE)), 'Session cookie is set as SameSite=Strict.');
}