function SessionExistsCacheContextTest::assertSessionCookieOnClient

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php \Drupal\Tests\system\Functional\Cache\SessionExistsCacheContextTest::assertSessionCookieOnClient()
  2. 8.9.x core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php \Drupal\Tests\system\Functional\Cache\SessionExistsCacheContextTest::assertSessionCookieOnClient()
  3. 10 core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php \Drupal\Tests\system\Functional\Cache\SessionExistsCacheContextTest::assertSessionCookieOnClient()

Asserts whether a session cookie is present on the client or not.

@internal

1 call to SessionExistsCacheContextTest::assertSessionCookieOnClient()
SessionExistsCacheContextTest::testCacheContext in core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php
Tests \Drupal\Core\Cache\Context\SessionExistsCacheContext::getContext().

File

core/modules/system/tests/src/Functional/Cache/SessionExistsCacheContextTest.php, line 68

Class

SessionExistsCacheContextTest
Tests the 'session.exists' cache context service.

Namespace

Drupal\Tests\system\Functional\Cache

Code

public function assertSessionCookieOnClient(bool $expected_present) : void {
    $this->assertEquals($expected_present, (bool) $this->getSession()
        ->getCookie($this->getSessionName()), 'Session cookie exists.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.