function UpdateScriptTest::testMaintenanceModeUpdateFunctionality

Same name and namespace in other branches
  1. 9 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testMaintenanceModeUpdateFunctionality()
  2. 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testMaintenanceModeUpdateFunctionality()
  3. 11.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testMaintenanceModeUpdateFunctionality()

Tests update.php while in maintenance mode.

File

core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php, line 587

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

public function testMaintenanceModeUpdateFunctionality() {
    $this->container
        ->get('state')
        ->set('system.maintenance_mode', TRUE);
    $initial_maintenance_mode = $this->container
        ->get('state')
        ->get('system.maintenance_mode');
    $this->assertTrue($initial_maintenance_mode, 'Site is in maintenance mode.');
    $this->runUpdates($initial_maintenance_mode);
    $final_maintenance_mode = $this->container
        ->get('state')
        ->get('system.maintenance_mode');
    $this->assertEqual($final_maintenance_mode, $initial_maintenance_mode, 'Maintenance mode should not have changed after database updates.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.