eb6c5fcebf6e768d70f03eaa78882c07ef433347
[yaffs-website] / web / core / modules / block / tests / src / Functional / BlockInstallTest.php
1 <?php
2
3 namespace Drupal\Tests\block\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests block module's installation.
9  *
10  * @group block
11  */
12 class BlockInstallTest extends BrowserTestBase {
13
14   public function testCacheTagInvalidationUponInstallation() {
15     // Warm the page cache.
16     $this->drupalGet('');
17     $this->assertNoText('Powered by Drupal');
18     $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', 'config:block_list');
19
20     // Install the block module, and place the "Powered by Drupal" block.
21     $this->container->get('module_installer')->install(['block', 'shortcut']);
22     $this->rebuildContainer();
23     $this->container->get('router.builder')->rebuild();
24     $this->drupalPlaceBlock('system_powered_by_block');
25
26     // Check the same page, block.module's hook_install() should have
27     // invalidated the 'rendered' cache tag to make blocks show up.
28     $this->drupalGet('');
29     $this->assertCacheTag('config:block_list');
30     $this->assertText('Powered by Drupal');
31   }
32
33 }