You are here

public function UpdateScriptTest::testMaintenanceModeUpdateFunctionality in Drupal 8

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()

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.');
}