function TermContextTest::testGetAvailableContexts

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/ContextProvider/TermContextTest.php \Drupal\Tests\taxonomy\Kernel\ContextProvider\TermContextTest::testGetAvailableContexts()
  2. 10 core/modules/taxonomy/tests/src/Kernel/ContextProvider/TermContextTest.php \Drupal\Tests\taxonomy\Kernel\ContextProvider\TermContextTest::testGetAvailableContexts()

@covers ::getAvailableContexts

File

core/modules/taxonomy/tests/src/Kernel/ContextProvider/TermContextTest.php, line 39

Class

TermContextTest
@coversDefaultClass \Drupal\taxonomy\ContextProvider\TermRouteContext

Namespace

Drupal\Tests\taxonomy\Kernel\ContextProvider

Code

public function testGetAvailableContexts() : void {
    $context_repository = $this->container
        ->get('context.repository');
    // Test taxonomy_term.taxonomy_term_route_context:taxonomy_term exists.
    $contexts = $context_repository->getAvailableContexts();
    $this->assertArrayHasKey('@taxonomy_term.taxonomy_term_route_context:taxonomy_term', $contexts);
    $this->assertSame('entity:taxonomy_term', $contexts['@taxonomy_term.taxonomy_term_route_context:taxonomy_term']->getContextDefinition()
        ->getDataType());
}

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