function BrowserTestBaseTest::testSessionOnRequest
Same name in other branches
- 10 core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php \Drupal\FunctionalTests\BrowserTestBaseTest::testSessionOnRequest()
Tests that a usable session is on the request in test-runner.
File
-
core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php, line 558
Class
- BrowserTestBaseTest
- Tests BrowserTestBase functionality.
Namespace
Drupal\FunctionalTestsCode
public function testSessionOnRequest() : void {
/** @var \Symfony\Component\HttpFoundation\Session\Session $session */
$session = $this->container
->get('request_stack')
->getSession();
$session->set('some-val', 'do-not-cleanup');
$this->assertEquals('do-not-cleanup', $session->get('some-val'));
$session->set('some-other-val', 'do-cleanup');
$this->assertEquals('do-cleanup', $session->remove('some-other-val'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.