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