function CookieCacheContextTest::providerTestGetContext

Same name in other branches
  1. 9 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 37

Class

CookieCacheContextTest
@coversDefaultClass \Drupal\Core\Cache\Context\CookiesCacheContext @group Cache

Namespace

Drupal\Tests\Core\Cache\Context

Code

public static 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.