annotate core/modules/block/tests/src/Functional/BlockInstallTest.php @ 19:fa3358dc1485 tip

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