public function HierarchicalTaxonomyMenuCacheTest::testBlockCacheContextAnonymous in Hierarchical Taxonomy Menu 8
Tests cache context for anonymous users.
File
- tests/
src/ Functional/ HierarchicalTaxonomyMenuCacheTest.php, line 94
Class
- HierarchicalTaxonomyMenuCacheTest
- Tests the Hierarchical Taxonomy Menu block caching.
Namespace
Drupal\Tests\hierarchical_taxonomy_menu\FunctionalCode
public function testBlockCacheContextAnonymous() {
$this
->drupalGet('<front>');
$this
->assertCacheContext('url.path');
$this
->drupalGet('taxonomy/term/1');
$this
->assertCacheContext('url.path');
$block_title_element = $this
->getSession()
->getPage()
->find('css', '#block-hierarchicaltaxonomymenu h2');
$this
->assertEqual($block_title_element
->getText(), 'Term 1');
$this
->drupalGet('taxonomy/term/2');
$this
->assertCacheContext('url.path');
$block_title_element = $this
->getSession()
->getPage()
->find('css', '#block-hierarchicaltaxonomymenu h2');
$this
->assertEqual($block_title_element
->getText(), 'Term 2');
}