function SessionTest::testSessionBag
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::testSessionBag()
- 8.9.x core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::testSessionBag()
- 10 core/modules/system/tests/src/Functional/Session/SessionTest.php \Drupal\Tests\system\Functional\Session\SessionTest::testSessionBag()
Tests session bag.
File
-
core/
modules/ system/ tests/ src/ Functional/ Session/ SessionTest.php, line 329
Class
- SessionTest
- Drupal session handling tests.
Namespace
Drupal\Tests\system\Functional\SessionCode
public function testSessionBag() : void {
// Ensure the flag is absent to start with.
$this->drupalGet('/session-test/has-bag-flag');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
$this->assertSession()
->statusCodeEquals(200);
// Set the flag.
$this->drupalGet('/session-test/set-bag-flag');
$this->assertSessionCookie(TRUE);
$this->assertSessionEmpty(TRUE);
$this->assertSession()
->statusCodeEquals(200);
// Ensure the flag is set.
$this->drupalGet('/session-test/has-bag-flag');
$this->assertSessionCookie(TRUE);
$this->assertSessionEmpty(FALSE);
$this->assertSession()
->statusCodeEquals(200);
// Clear the flag.
$this->drupalGet('/session-test/clear-bag-flag');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(FALSE);
$this->assertSession()
->statusCodeEquals(200);
// Ensure the flag is absent again.
$this->drupalGet('/session-test/has-bag-flag');
$this->assertSessionCookie(FALSE);
$this->assertSessionEmpty(TRUE);
$this->assertSession()
->statusCodeEquals(200);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.