public function BlockInstallTest::testCacheTagInvalidationUponInstallation in Drupal 9
Same name and namespace in other branches
- 8 core/modules/block/tests/src/Functional/BlockInstallTest.php \Drupal\Tests\block\Functional\BlockInstallTest::testCacheTagInvalidationUponInstallation()
File
- core/
modules/ block/ tests/ src/ Functional/ BlockInstallTest.php, line 19
Class
- BlockInstallTest
- Tests block module's installation.
Namespace
Drupal\Tests\block\FunctionalCode
public function testCacheTagInvalidationUponInstallation() {
// Warm the page cache.
$this
->drupalGet('');
$this
->assertSession()
->pageTextNotContains('Powered by Drupal');
$this
->assertSession()
->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:block_list');
// Install the block module, and place the "Powered by Drupal" block.
$this->container
->get('module_installer')
->install([
'block',
'shortcut',
]);
$this
->rebuildContainer();
$this
->drupalPlaceBlock('system_powered_by_block');
// Check the same page, block.module's hook_install() should have
// invalidated the 'rendered' cache tag to make blocks show up.
$this
->drupalGet('');
$this
->assertSession()
->responseHeaderContains('X-Drupal-Cache-Tags', 'config:block_list');
$this
->assertSession()
->pageTextContains('Powered by Drupal');
}