function SessionTestCase::testSameSiteCookieAttributeNone

Test SameSite attribute = None on session cookies.

File

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

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

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