You are here

public function TermContextTest::testGetAvailableContexts in Drupal 10

Same name and namespace in other branches
  1. 9 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 37

Class

TermContextTest
@coversDefaultClass \Drupal\taxonomy\ContextProvider\TermRouteContext

Namespace

Drupal\Tests\taxonomy\Kernel\ContextProvider

Code

public function testGetAvailableContexts() {
  $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());
}