You are here

public function QueryArgsCacheContextTest::testGetContext in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Cache/Context/QueryArgsCacheContextTest.php \Drupal\Tests\Core\Cache\Context\QueryArgsCacheContextTest::testGetContext()
  2. 9 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 21

Class

QueryArgsCacheContextTest
@coversDefaultClass \Drupal\Core\Cache\Context\QueryArgsCacheContext @group Cache

Namespace

Drupal\Tests\Core\Cache\Context

Code

public function testGetContext(array $query_args, $cache_context_parameter, $context) {
  $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);
}