function BlockConfigSyncTest::setUp
Overrides KernelTestBase::setUp
File
-
core/
modules/ block/ tests/ src/ Kernel/ BlockConfigSyncTest.php, line 28
Class
- BlockConfigSyncTest
- Tests that blocks are not created during config sync.
Namespace
Drupal\Tests\block\KernelCode
protected function setUp() : void {
parent::setUp();
\Drupal::service(ThemeInstallerInterface::class)->install([
'stark',
'claro',
]);
// Delete all existing blocks.
foreach (Block::loadMultiple() as $block) {
$block->delete();
}
// Set the default theme.
$this->config('system.theme')
->set('default', 'stark')
->save();
// Create a block for the default theme to be copied later.
Block::create([
'id' => 'test_block',
'plugin' => 'system_powered_by_block',
'region' => 'content',
'theme' => 'stark',
])->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.