You are here

function SessionTestCase::testSameSiteCookieAttributeNone in Drupal 7

Test SameSite attribute = None on session cookies.

File

modules/simpletest/tests/session.test, line 296
Provides SimpleTests for core session handling functionality.

Class

SessionTestCase
@file Provides SimpleTests for core session handling functionality.

Code

function testSameSiteCookieAttributeNone() {
  variable_set('samesite_cookie_value', 'None');
  $user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this
    ->sessionReset($user->uid);
  $this
    ->drupalLogin($user);
  $this
    ->assertTrue(preg_match('/SameSite=None/i', $this
    ->drupalGetHeader('Set-Cookie', TRUE)), 'Session cookie is set as SameSite=None.');
}