You are here

protected function BrowserTestBase::getSessionCookies in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::getSessionCookies()
  2. 10 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.

13 calls to BrowserTestBase::getSessionCookies()
CommentNewIndicatorTest::renderNewCommentsNodeLinks in core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
Get node "x new comments" metadata from the server for the current user.
ContextualDynamicContextTest::renderContextualLinks in core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php
Get server-rendered contextual links for the given contextual link ids.
ContextualDynamicContextTest::testTokenProtection in core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php
Tests the contextual placeholder content is protected by a token.
CsrfRequestHeaderTest::testRouteAccess in core/modules/system/tests/src/Functional/CsrfRequestHeaderTest.php
Tests access to routes protected by CSRF request header requirements.
EditorIntegrationLoadingTest::testUsersWithoutPermission in core/modules/quickedit/tests/src/Functional/EditorIntegrationLoadingTest.php
Tests loading of untransformed text when a user doesn't have access to it.

... See full list

File

core/tests/Drupal/Tests/BrowserTestBase.php, line 488

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\Tests

Code

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;
}