function UpdateScriptTest::testSuccessfulUpdateFunctionality
Same name in other branches
- 9 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testSuccessfulUpdateFunctionality()
- 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testSuccessfulUpdateFunctionality()
- 11.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::testSuccessfulUpdateFunctionality()
Tests update.php after performing a successful update.
File
-
core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php, line 546
Class
- UpdateScriptTest
- Tests the update script access and functionality.
Namespace
Drupal\Tests\system\Functional\UpdateSystemCode
public function testSuccessfulUpdateFunctionality() {
$initial_maintenance_mode = $this->container
->get('state')
->get('system.maintenance_mode');
$this->assertNull($initial_maintenance_mode, 'Site is not 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.');
// Reset the static cache to ensure we have the most current setting.
$schema_version = drupal_get_installed_schema_version('update_script_test', TRUE);
$this->assertEqual($schema_version, 8001, 'update_script_test schema version is 8001 after updating.');
// Set the installed schema version to one less than the current update.
drupal_set_installed_schema_version('update_script_test', $schema_version - 1);
$schema_version = drupal_get_installed_schema_version('update_script_test', TRUE);
$this->assertEqual($schema_version, 8000, 'update_script_test schema version overridden to 8000.');
// Click through update.php with 'access administration pages' and
// 'access site reports' permissions.
$admin_user = $this->drupalCreateUser([
'administer software updates',
'access administration pages',
'access site reports',
'access site in maintenance mode',
]);
$this->drupalLogin($admin_user);
$this->drupalGet($this->updateUrl, [
'external' => TRUE,
]);
$this->updateRequirementsProblem();
$this->clickLink(t('Continue'));
$this->clickLink(t('Apply pending updates'));
$this->checkForMetaRefresh();
$this->assertText('Updates were attempted.');
$this->assertSession()
->linkExists('logged');
$this->assertSession()
->linkExists('Administration pages');
$this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [
':href' => 'update.php',
]));
$this->clickLink('Administration pages');
$this->assertSession()
->statusCodeEquals(200);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.