function CookieCacheContextTest::providerTestGetContext

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Cache/Context/CookieCacheContextTest.php \Drupal\Tests\Core\Cache\Context\CookieCacheContextTest::providerTestGetContext()
  2. 11.x core/tests/Drupal/Tests/Core/Cache/Context/CookieCacheContextTest.php \Drupal\Tests\Core\Cache\Context\CookieCacheContextTest::providerTestGetContext()

Provides a list of cookies and expected cache contexts.

File

core/tests/Drupal/Tests/Core/Cache/Context/CookieCacheContextTest.php, line 35

Class

CookieCacheContextTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Cache%21Context%21CookiesCacheContext.php/class/CookiesCacheContext/9" title="Defines the CookiesCacheContext service, for &quot;per cookie&quot; caching." class="local">\Drupal\Core\Cache\Context\CookiesCacheContext</a> @group Cache

Namespace

Drupal\Tests\Core\Cache\Context

Code

public function providerTestGetContext() {
    return [
        [
            [
                'foo' => 1,
                'bar' => 2,
                'baz' => 3,
            ],
            'foo',
            1,
        ],
        // Context is ordered by cookie name.
[
            [
                'foo' => 1,
                'bar' => 2,
                'baz' => 3,
            ],
            NULL,
            'bar=2&baz=3&foo=1',
        ],
    ];
}

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