diff --git a/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php b/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php index 6f56975..c359b3b 100644 --- a/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php +++ b/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php @@ -41,11 +41,24 @@ protected function setDatabaseDumpFiles() { public function testUpdateHookN() { $this->runUpdates(); - // Verify that a block is in the default region. + // Disable maintenance mode. + \Drupal::state()->set('system.maintenance_mode', FALSE); + + // We finished updating so we can login the user now. + $this->drupalLogin($this->rootUser); + + // Verify that a disabled block is in the default region. + $this->drupalGet('admin/structure/block'); + $element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]", + [':block' => 'edit-blocks-pagetitle-1', ':status' => 'block-disabled', ':region' => 'header']); + $this->assertTrue(!empty($element)); + + // Verify that an enabled block is in the default region. $this->drupalGet('admin/structure/block'); - $element = $this->xpath('//tr[contains(@class, :class)]', [':class' => 'region-title-header']); + $element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]", + [':block' => 'edit-blocks-pagetitle-2', ':status' => 'block-enabled', ':region' => 'header']); $this->assertTrue(!empty($element)); - + } } diff --git a/core/modules/system/tests/fixtures/update/block.block.secondtestfor2513534.yml b/core/modules/system/tests/fixtures/update/block.block.secondtestfor2513534.yml new file mode 100644 index 0000000..b1dbbae --- /dev/null +++ b/core/modules/system/tests/fixtures/update/block.block.secondtestfor2513534.yml @@ -0,0 +1,18 @@ +uuid: 3c4e92c3-5fb1-408d-993c-6066559230be +langcode: en +status: true +dependencies: + theme: + - bartik +id: pagetitle_2 +theme: bartik +region: header +weight: null +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/block.block.testfor2513534.yml b/core/modules/system/tests/fixtures/update/block.block.testfor2513534.yml index 2ee1401..b8a55fa 100644 --- a/core/modules/system/tests/fixtures/update/block.block.testfor2513534.yml +++ b/core/modules/system/tests/fixtures/update/block.block.testfor2513534.yml @@ -4,7 +4,7 @@ status: false dependencies: theme: - bartik -id: pagetitle +id: pagetitle_1 theme: bartik region: '-1' weight: -8 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 index 057613b..0493773 100644 --- 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 @@ -13,8 +13,8 @@ // A disabled block. $block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2513534.yml')); -// An block placed in a region. -//$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2513534.yml')); +// A block placed in the default region. +$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2513534.yml')); foreach ($block_configs as $block_config) { $connection->insert('config') @@ -42,7 +42,7 @@ $connection->update('key_value') ->fields([ - 'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2513534', /*'block.block.secondtestfor2513534'*/])) + 'value' => serialize(array_merge($existing_blocks, ['block.block.testfor2513534', 'block.block.secondtestfor2513534'])) ]) ->condition('collection', 'config.entity.key_store.block') ->condition('name', 'theme:bartik')