function SessionTest::testSessionPersistenceOnLogin

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::testSessionPersistenceOnLogin()
  2. 10 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::testSessionPersistenceOnLogin()
  3. 11.x core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::testSessionPersistenceOnLogin()

Tests storing data in Session() object.

File

core/modules/system/tests/src/Functional/Session/SessionTest.php, line 156

Class

SessionTest
Drupal session handling tests.

Namespace

Drupal\Tests\system\Functional\Session

Code

public function testSessionPersistenceOnLogin() {
    // Store information via hook_user_login().
    $user = $this->drupalCreateUser();
    $this->drupalLogin($user);
    // Test property added to session object form hook_user_login().
    $this->drupalGet('session-test/get-from-session-object');
    $this->assertText('foobar', 'Session data is saved in Session() object.', 'Session');
}

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