You are here

public function SessionTest::testSessionPersistenceOnLogin in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::testSessionPersistenceOnLogin()
  2. 9 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 169

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
    ->assertSession()
    ->pageTextContains('foobar');
}