protected function BrowserTestBase::getSessionCookies in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::getSessionCookies()
- 9 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::getSessionCookies()
Get session cookies from current session.
Return value
\GuzzleHttp\Cookie\CookieJar A cookie jar with the current session.
3 calls to BrowserTestBase::getSessionCookies()
- SessionAuthenticationTest::testBasicAuthNoSession in core/
modules/ system/ tests/ src/ Functional/ Session/ SessionAuthenticationTest.php - Tests that a session is not started automatically by basic authentication.
- SessionTest::assertSessionCookie in core/
modules/ system/ tests/ src/ Functional/ Session/ SessionTest.php - Assert whether the test browser sent a session cookie.
- StackSessionHandlerIntegrationTest::testRequest in core/
modules/ system/ tests/ src/ Functional/ Session/ StackSessionHandlerIntegrationTest.php - Tests a request.
File
- core/
tests/ Drupal/ Tests/ BrowserTestBase.php, line 486
Class
- BrowserTestBase
- Provides a test case for functional Drupal tests.
Namespace
Drupal\TestsCode
protected function getSessionCookies() {
$domain = parse_url($this
->getUrl(), PHP_URL_HOST);
$session_id = $this
->getSession()
->getCookie($this
->getSessionName());
$cookies = CookieJar::fromArray([
$this
->getSessionName() => $session_id,
], $domain);
return $cookies;
}