3 namespace Drupal\Tests\block\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
8 * Tests the upgrade path for removal of disabled region.
10 * @see https://www.drupal.org/node/2513534
15 class BlockRemoveDisabledRegionUpdateTest extends UpdatePathTestBase {
20 protected static $modules = ['block_test', 'language'];
25 protected function setDatabaseDumpFiles() {
26 $this->databaseDumpFiles = [
27 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
28 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php',
33 * Tests that block context mapping is updated properly.
35 public function testUpdateHookN() {
38 // Disable maintenance mode.
39 \Drupal::state()->set('system.maintenance_mode', FALSE);
41 // We finished updating so we can login the user now.
42 $this->drupalLogin($this->rootUser);
44 // Verify that a disabled block is in the default region.
45 $this->drupalGet('admin/structure/block');
46 $element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]",
47 [':block' => 'edit-blocks-pagetitle-1', ':status' => 'block-disabled', ':region' => 'header']);
48 $this->assertTrue(!empty($element));
50 // Verify that an enabled block is now disabled and in the default region.
51 $this->drupalGet('admin/structure/block');
52 $element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]",
53 [':block' => 'edit-blocks-pagetitle-2', ':status' => 'block-disabled', ':region' => 'header']);
54 $this->assertTrue(!empty($element));