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
14 class BlockRemoveDisabledRegionUpdateTest extends UpdatePathTestBase {
19 protected static $modules = ['block_test', 'language'];
24 protected function setDatabaseDumpFiles() {
25 $this->databaseDumpFiles = [
26 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
27 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php',
32 * Tests that block context mapping is updated properly.
34 public function testUpdateHookN() {
37 // Disable maintenance mode.
38 \Drupal::state()->set('system.maintenance_mode', FALSE);
40 // We finished updating so we can login the user now.
41 $this->drupalLogin($this->rootUser);
43 // Verify that a disabled block is in the default region.
44 $this->drupalGet('admin/structure/block');
45 $element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]",
46 [':block' => 'edit-blocks-pagetitle-1', ':status' => 'block-disabled', ':region' => 'header']);
47 $this->assertTrue(!empty($element));
49 // Verify that an enabled block is now disabled and in the default region.
50 $this->drupalGet('admin/structure/block');
51 $element = $this->xpath("//tr[contains(@data-drupal-selector, :block) and contains(@class, :status)]//select/option[@selected and @value=:region]",
52 [':block' => 'edit-blocks-pagetitle-2', ':status' => 'block-disabled', ':region' => 'header']);
53 $this->assertTrue(!empty($element));