core/modules/block/block.module | 5 +-- core/modules/block/src/Tests/BlockInstallTest.php | 38 +++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/core/modules/block/block.module b/core/modules/block/block.module index cee87f0..e65d07a 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -307,10 +307,11 @@ function block_configurable_language_delete(ConfigurableLanguageInterface $langu } } } + /** - * Implements hook_modules_installed(). + * Implements hook_install(). */ -function block_modules_installed() { +function block_install() { // Because the Block module upon installation unconditionally overrides all // HTML output by selecting a different page display variant, we must // invalidate all cached HTML output. diff --git a/core/modules/block/src/Tests/BlockInstallTest.php b/core/modules/block/src/Tests/BlockInstallTest.php index e69de29..84819e6 100644 --- a/core/modules/block/src/Tests/BlockInstallTest.php +++ b/core/modules/block/src/Tests/BlockInstallTest.php @@ -0,0 +1,38 @@ +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'); + } + +}