function TermContextTest::testGetAvailableContexts

@covers ::getAvailableContexts

File

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

Class

TermContextTest
@coversDefaultClass \Drupal\taxonomy\ContextProvider\TermRouteContext[[api-linebreak]]

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.