function SessionTestCase::testSameSiteCookieAttributeLax

Test SameSite attribute = Lax on session cookies.

File

modules/simpletest/tests/session.test, line 371

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.');
}

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