function TermContextTest::testGetAvailableContexts
Same name and namespace in other branches
- 10 core/modules/taxonomy/tests/src/Kernel/ContextProvider/TermContextTest.php \Drupal\Tests\taxonomy\Kernel\ContextProvider\TermContextTest::testGetAvailableContexts()
- 11.x 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 <a href="/api/drupal/core%21modules%21taxonomy%21src%21ContextProvider%21TermRouteContext.php/class/TermRouteContext/9" title="Sets the current taxonomy term as a context on taxonomy term routes." class="local">\Drupal\taxonomy\ContextProvider\TermRouteContext</a>
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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.