You are here

protected function LocalTaskManagerTest::setupNullCacheabilityMetadataValidation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php \Drupal\Tests\Core\Menu\LocalTaskManagerTest::setupNullCacheabilityMetadataValidation()
1 call to LocalTaskManagerTest::setupNullCacheabilityMetadataValidation()
LocalTaskManagerTest::setUp in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php

File

core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php, line 485
Contains \Drupal\Tests\Core\Menu\LocalTaskManagerTest.

Class

LocalTaskManagerTest
@coversDefaultClass \Drupal\Core\Menu\LocalTaskManager @group Menu

Namespace

Drupal\Tests\Core\Menu

Code

protected function setupNullCacheabilityMetadataValidation() {
  $container = \Drupal::hasContainer() ? \Drupal::getContainer() : new ContainerBuilder();
  $cache_context_manager = $this
    ->prophesize(CacheContextsManager::class);
  foreach ([
    NULL,
    [
      'user.permissions',
    ],
    [
      'route',
    ],
    [
      'route',
      'context.example1',
    ],
    [
      'context.example1',
      'route',
    ],
    [
      'context.example1',
      'route',
      'context.example2',
    ],
    [
      'context.example1',
      'context.example2',
      'route',
    ],
    [
      'context.example1',
      'context.example2',
      'route',
      'user.permissions',
    ],
  ] as $argument) {
    $cache_context_manager
      ->assertValidTokens($argument)
      ->willReturn(TRUE);
  }
  $container
    ->set('cache_contexts_manager', $cache_context_manager
    ->reveal());
  \Drupal::setContainer($container);
}