diff --git a/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php b/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php index 3ceee45..6f56975 100644 --- a/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php +++ b/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php @@ -31,6 +31,7 @@ class BlockRemoveDisabledRegionUpdateTest extends UpdatePathTestBase { protected function setDatabaseDumpFiles() { $this->databaseDumpFiles = [ __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', + __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php', ]; } @@ -41,6 +42,9 @@ public function testUpdateHookN() { $this->runUpdates(); // Verify that a block is in the default region. + $this->drupalGet('admin/structure/block'); + $element = $this->xpath('//tr[contains(@class, :class)]', [':class' => 'region-title-header']); + $this->assertTrue(!empty($element)); } diff --git a/core/modules/system/tests/fixtures/update/block.block.testfor2513534.yml b/core/modules/system/tests/fixtures/update/block.block.testfor2513534.yml new file mode 100644 index 0000000..2ee1401 --- /dev/null +++ b/core/modules/system/tests/fixtures/update/block.block.testfor2513534.yml @@ -0,0 +1,18 @@ +uuid: 87097da9-29d1-441f-8b00-b93852c760d6 +langcode: en +status: false +dependencies: + theme: + - bartik +id: pagetitle +theme: bartik +region: '-1' +weight: -8 +provider: null +plugin: page_title_block +settings: + id: page_title_block + label: 'Page title' + provider: core + label_display: '0' +visibility: { } diff --git a/core/modules/system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php b/core/modules/system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php new file mode 100644 index 0000000..057613b --- /dev/null +++ b/core/modules/system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php @@ -0,0 +1,49 @@ +insert('config') + ->fields(array( + 'collection', + 'name', + 'data', + )) + ->values(array( + 'collection' => '', + 'name' => 'block.block.' . $block_config['id'], + 'data' => serialize($block_config), + )) + ->execute(); +} + +// Update the config entity query "index". +$existing_blocks = $connection->select('key_value') + ->fields('key_value', ['value']) + ->condition('collection', 'config.entity.key_store.block') + ->condition('name', 'theme:bartik') + ->execute() + ->fetchField(); +$existing_blocks = unserialize($existing_blocks); + +$connection->update('key_value') + ->fields([ + 'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2513534', /*'block.block.secondtestfor2513534'*/])) + ]) + ->condition('collection', 'config.entity.key_store.block') + ->condition('name', 'theme:bartik') + ->execute();