function SessionTest::testSessionPersistenceOnLogin

Tests storing data in Session() object.

File

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

Class

SessionTest
Drupal session handling tests.

Namespace

Drupal\Tests\system\Functional\Session

Code

public function testSessionPersistenceOnLogin() : void {
  // 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');
}

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