public function BlockRemoveDisabledRegionUpdateTest::testUpdateHookN in Drupal 8
Tests that block context mapping is updated properly.
File
- core/
modules/ block/ tests/ src/ Functional/ Update/ BlockRemoveDisabledRegionUpdateTest.php, line 35
Class
- BlockRemoveDisabledRegionUpdateTest
- Tests the upgrade path for removal of disabled region.
Namespace
Drupal\Tests\block\Functional\UpdateCode
public function testUpdateHookN() {
$this
->runUpdates();
// 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 now disabled and 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-2',
':status' => 'block-disabled',
':region' => 'header',
]);
$this
->assertTrue(!empty($element));
}