BlockInstallTest.php 1022 B

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