You are here

function SessionTestCase::testSamesiteCookieLogoutLax in Drupal 7

Test SameSite attribute = Lax on set-cookie header on logout.

File

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

Class

SessionTestCase
@file Provides SimpleTests for core session handling functionality.

Code

function testSamesiteCookieLogoutLax() {
  variable_set('samesite_cookie_value', 'Lax');
  $user = $this
    ->drupalCreateUser(array(
    'access content',
  ));
  $this
    ->sessionReset($user->uid);
  $this
    ->drupalLogin($user);
  $this
    ->drupalGet('user/logout');
  $this
    ->assertTrue(preg_match('/SameSite=Lax/i', $this
    ->drupalGetHeader('Set-Cookie', TRUE)), 'Session cookie deletion includes SameSite=Lax.');
}