diff core/modules/block/tests/src/Functional/BlockInstallTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/block/tests/src/Functional/BlockInstallTest.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,33 @@
+<?php
+
+namespace Drupal\Tests\block\Functional;
+
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Tests block module's installation.
+ *
+ * @group block
+ */
+class BlockInstallTest extends BrowserTestBase {
+
+  public function testCacheTagInvalidationUponInstallation() {
+    // Warm the page cache.
+    $this->drupalGet('');
+    $this->assertNoText('Powered by Drupal');
+    $this->assertNoCacheTag('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->container->get('router.builder')->rebuild();
+    $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->assertCacheTag('config:block_list');
+    $this->assertText('Powered by Drupal');
+  }
+
+}