function QueryArgsCacheContextTest::testGetContext
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php \Drupal\Tests\Core\Cache\Context\QueryArgsCacheContextTest::testGetContext()
- 8.9.x core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php \Drupal\Tests\Core\Cache\Context\QueryArgsCacheContextTest::testGetContext()
- 10 core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php \Drupal\Tests\Core\Cache\Context\QueryArgsCacheContextTest::testGetContext()
@covers ::getContext
@dataProvider providerTestGetContext
File
-
core/
tests/ Drupal/ Tests/ Core/ Cache/ Context/ QueryArgsCacheContextTest.php, line 23
Class
- QueryArgsCacheContextTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Cache%21Context%21QueryArgsCacheContext.php/class/QueryArgsCacheContext/11.x" title="Defines the QueryArgsCacheContext service, for "per query args" caching." class="local">\Drupal\Core\Cache\Context\QueryArgsCacheContext</a> @group Cache
Namespace
Drupal\Tests\Core\Cache\ContextCode
public function testGetContext(array $query_args, $cache_context_parameter, $context) : void {
$request_stack = new RequestStack();
$request = Request::create('/', 'GET', $query_args);
$request_stack->push($request);
$cache_context = new QueryArgsCacheContext($request_stack);
$this->assertSame($cache_context->getContext($cache_context_parameter), $context);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.