function BlockRemoveSyndicateBlocksUpdateTest::testRemoveSyndicateBlocks
Tests that node module Syndicate blocks are deleted in all themes.
File
-
core/
modules/ block/ tests/ src/ Functional/ Update/ BlockRemoveSyndicateBlocksUpdateTest.php, line 36
Class
- BlockRemoveSyndicateBlocksUpdateTest
- Tests removing blocks placed using the removed Syndicate block plugin.
Namespace
Drupal\Tests\block\Functional\UpdateCode
public function testRemoveSyndicateBlocks() : void {
$config_factory = $this->container
->get('config.factory');
$syndicate_blocks = [
'block.block.olivero_syndicate',
'block.block.stark_syndicate',
];
foreach ($syndicate_blocks as $name) {
$this->assertSame('node_syndicate_block', $config_factory->get($name)
->get('plugin'));
}
$this->assertSame('custom_syndicate', $config_factory->get('block.block.stark_custom_syndicate')
->get('settings.provider'));
$this->assertFalse($config_factory->get('block.block.stark_powered')
->isNew());
$this->runUpdates();
$config_factory = $this->container
->get('config.factory');
foreach ($syndicate_blocks as $name) {
$this->assertTrue($config_factory->get($name)
->isNew(), "{$name} was deleted.");
}
// A block using the same plugin ID from another provider is kept, which
// allows a contrib module to take over the block before the update.
$this->assertFalse($config_factory->get('block.block.stark_custom_syndicate')
->isNew());
// Other blocks are not affected.
$this->assertFalse($config_factory->get('block.block.stark_powered')
->isNew());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.