function DefaultPluginManagerTest::testGetCacheContexts

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testGetCacheContexts()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testGetCacheContexts()
  3. 11.x core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php \Drupal\Tests\Core\Plugin\DefaultPluginManagerTest::testGetCacheContexts()

@covers ::getCacheContexts

File

core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php, line 342

Class

DefaultPluginManagerTest
Tests the DefaultPluginManager.

Namespace

Drupal\Tests\Core\Plugin

Code

public function testGetCacheContexts() {
    $module_handler = $this->prophesize(ModuleHandlerInterface::class);
    $plugin_manager = new TestPluginManager($this->namespaces, $this->expectedDefinitions, $module_handler->reveal(), NULL);
    $cache_contexts = $plugin_manager->getCacheContexts();
    $this->assertIsArray($cache_contexts);
    array_map(function ($cache_context) {
        $this->assertIsString($cache_context);
    }, $cache_contexts);
}

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