function LocalTaskManagerTest::setupNullCacheabilityMetadataValidation

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php \Drupal\Tests\Core\Menu\LocalTaskManagerTest::setupNullCacheabilityMetadataValidation()
  2. 10 core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php \Drupal\Tests\Core\Menu\LocalTaskManagerTest::setupNullCacheabilityMetadataValidation()
  3. 11.x 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 474

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',
        ],
        [
            'route',
            'context.example1',
            'context.example2',
        ],
        [
            'context.example1',
            'context.example2',
            'route',
        ],
        [
            'route',
            'context.example1',
            'context.example2',
            'user.permissions',
        ],
    ] as $argument) {
        $cache_context_manager->assertValidTokens($argument)
            ->willReturn(TRUE);
    }
    $container->set('cache_contexts_manager', $cache_context_manager->reveal());
    \Drupal::setContainer($container);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.