function UpdateScriptTest::testMaintenanceModeUpdateFunctionality

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testMaintenanceModeUpdateFunctionality()
  2. 8.9.x 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 744

Class

UpdateScriptTest
Tests the update script access and functionality.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

public function testMaintenanceModeUpdateFunctionality() : void {
    $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->assertEquals($initial_maintenance_mode, $final_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.