class BlockRemoveSyndicateBlocksUpdateTest
Tests removing blocks placed using the removed Syndicate block plugin.
Attributes
#[Group('Update')]
#[Group('block')]
#[CoversFunction('block_post_update_remove_syndicate_blocks')]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\Tests\DrupalTestCase uses \Drupal\Tests\DrupalTestCaseTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\ExtensionListTestTrait extends \Drupal\Tests\DrupalTestCase
- class \Drupal\FunctionalTests\Update\UpdatePathTestBase uses \Drupal\Tests\UpdatePathTestTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\block\Functional\Update\BlockRemoveSyndicateBlocksUpdateTest extends \Drupal\FunctionalTests\Update\UpdatePathTestBase
- class \Drupal\FunctionalTests\Update\UpdatePathTestBase uses \Drupal\Tests\UpdatePathTestTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\ExtensionListTestTrait extends \Drupal\Tests\DrupalTestCase
Expanded class hierarchy of BlockRemoveSyndicateBlocksUpdateTest
See also
block_post_update_remove_syndicate_blocks()
File
-
core/
modules/ block/ tests/ src/ Functional/ Update/ BlockRemoveSyndicateBlocksUpdateTest.php, line 17
Namespace
Drupal\Tests\block\Functional\UpdateView source
class BlockRemoveSyndicateBlocksUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() : void {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-11.3.0.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/syndicate-block-config.php',
];
}
/**
* Tests that node module Syndicate blocks are deleted in all themes.
*/
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.