function CacheContextsManagerTest::testAvailableContextLabels

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::testAvailableContextLabels()
  2. 10 core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::testAvailableContextLabels()
  3. 11.x core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php \Drupal\Tests\Core\Cache\Context\CacheContextsManagerTest::testAvailableContextLabels()

File

core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php, line 166

Class

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

Namespace

Drupal\Tests\Core\Cache\Context

Code

public function testAvailableContextLabels() {
    $container = $this->getMockContainer();
    $cache_contexts_manager = new CacheContextsManager($container, $this->getContextsFixture());
    $labels = $cache_contexts_manager->getLabels();
    $expected = [
        "foo" => "Foo",
    ];
    $this->assertEquals($expected, $labels);
}

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