public function TermContextTest::testGetAvailableContexts in Drupal 9
@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\ContextProviderCode
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());
}