class BlockInstallTest
Same name and namespace in other branches
- 11.x core/modules/block/tests/src/Functional/BlockInstallTest.php \Drupal\Tests\block\Functional\BlockInstallTest
- 10 core/modules/block/tests/src/Functional/BlockInstallTest.php \Drupal\Tests\block\Functional\BlockInstallTest
- 8.9.x core/modules/block/tests/src/Functional/BlockInstallTest.php \Drupal\Tests\block\Functional\BlockInstallTest
Tests block module's installation.
@group block
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\block\Functional\BlockInstallTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of BlockInstallTest
File
-
core/
modules/ block/ tests/ src/ Functional/ BlockInstallTest.php, line 12
Namespace
Drupal\Tests\block\FunctionalView source
class BlockInstallTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
public function testCacheTagInvalidationUponInstallation() {
// Warm the page cache.
$this->drupalGet('');
$this->assertSession()
->pageTextNotContains('Powered by Drupal');
$this->assertSession()
->responseHeaderNotContains('X-Drupal-Cache-Tags', '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->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->assertSession()
->responseHeaderContains('X-Drupal-Cache-Tags', 'config:block_list');
$this->assertSession()
->pageTextContains('Powered by Drupal');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.