You are here

public function CacheContextsManagerTest::testInvalidContext in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::testInvalidContext()

@covers ::convertTokensToKeys

File

core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php, line 129
Contains \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest.

Class

CacheContextsManagerTest
@coversDefaultClass \Drupal\Core\Cache\Context\CacheContextsManager @group Cache

Namespace

Drupal\Tests\Core\Cache\Context

Code

public function testInvalidContext() {
  $container = $this
    ->getMockContainer();
  $cache_contexts_manager = new CacheContextsManager($container, $this
    ->getContextsFixture());
  $this
    ->expectException(\AssertionError::class);
  $cache_contexts_manager
    ->convertTokensToKeys([
    "non-cache-context",
  ]);
}