Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / block / tests / src / Functional / Update / BlockRemoveDisabledRegionUpdateTest.php
1 <?php
2
3 namespace Drupal\Tests\block\Functional\Update;
4
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests the upgrade path for removal of disabled region.
9  *
10  * @see https://www.drupal.org/node/2513534
11  *
12  * @group Update
13  */
14 class BlockRemoveDisabledRegionUpdateTest extends UpdatePathTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   protected static $modules = ['block_test', 'language'];
20
21   /**
22    * {@inheritdoc}
23    */
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',
28     ];
29   }
30
31   /**
32    * Tests that block context mapping is updated properly.
33    */
34   public function testUpdateHookN() {
35     $this->runUpdates();
36
37     // Disable maintenance mode.
38     \Drupal::state()->set('system.maintenance_mode', FALSE);
39
40     // We finished updating so we can login the user now.
41     $this->drupalLogin($this->rootUser);
42
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));
48
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));
54
55   }
56
57 }