function BrowserTestBase::getSessionCookies
Same name and namespace in other branches
- 10 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::getSessionCookies()
- 11.x 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.
5 calls to BrowserTestBase::getSessionCookies()
- CsrfRequestHeaderTest::testRouteAccess in core/
modules/ system/ tests/ src/ Functional/ CsrfRequestHeaderTest.php - Tests access to routes protected by CSRF request header requirements.
- HistoryTest::getNodeReadTimestamps in core/
modules/ history/ tests/ src/ Functional/ HistoryTest.php - Get node read timestamps from the server for the current user.
- HistoryTest::markNodeAsRead in core/
modules/ history/ tests/ src/ Functional/ HistoryTest.php - Mark a node as read for the current user.
- SaveUploadTest::testInvalidUtf8FilenameUpload in core/
modules/ file/ tests/ src/ Functional/ SaveUploadTest.php - Tests that filenames containing invalid UTF-8 are rejected.
- SessionAuthenticationTest::testBasicAuthNoSession in core/
modules/ system/ tests/ src/ Functional/ Session/ SessionAuthenticationTest.php - Tests that a session is not started automatically by basic authentication.
File
-
core/
tests/ Drupal/ Tests/ BrowserTestBase.php, line 476
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.