function UpdateScriptTest::runUpdates
Same name in other branches
- 9 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::runUpdates()
- 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::runUpdates()
- 11.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php \Drupal\Tests\system\Functional\UpdateSystem\UpdateScriptTest::runUpdates()
Helper function to run updates via the browser.
2 calls to UpdateScriptTest::runUpdates()
- UpdateScriptTest::testMaintenanceModeUpdateFunctionality in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php - Tests update.php while in maintenance mode.
- UpdateScriptTest::testSuccessfulUpdateFunctionality in core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php - Tests update.php after performing a successful update.
File
-
core/
modules/ system/ tests/ src/ Functional/ UpdateSystem/ UpdateScriptTest.php, line 687
Class
- UpdateScriptTest
- Tests the update script access and functionality.
Namespace
Drupal\Tests\system\Functional\UpdateSystemCode
protected function runUpdates($maintenance_mode) {
$schema_version = drupal_get_installed_schema_version('update_script_test');
$this->assertEqual($schema_version, 8001, 'update_script_test is initially installed with schema version 8001.');
// 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 'administer software updates' permission.
$this->drupalLogin($this->updateUser);
if ($maintenance_mode) {
$this->assertText('Operating in maintenance mode.');
}
else {
$this->assertNoText('Operating in maintenance mode.');
}
$this->drupalGet($this->updateUrl, [
'external' => TRUE,
]);
$this->updateRequirementsProblem();
$this->clickLink(t('Continue'));
$this->clickLink(t('Apply pending updates'));
$this->checkForMetaRefresh();
// Verify that updates were completed successfully.
$this->assertText('Updates were attempted.');
$this->assertSession()
->linkExists('site');
$this->assertText('The update_script_test_update_8001() update was executed successfully.');
// Verify that no 7.x updates were run.
$this->assertNoText('The update_script_test_update_7200() update was executed successfully.');
$this->assertNoText('The update_script_test_update_7201() update was executed successfully.');
// Verify that there are no links to different parts of the workflow.
$this->assertSession()
->linkNotExists('Administration pages');
$this->assertEmpty($this->xpath('//main//a[contains(@href, :href)]', [
':href' => 'update.php',
]));
$this->assertSession()
->linkNotExists('logged');
// Verify the front page can be visited following the upgrade.
$this->clickLink('Front page');
$this->assertSession()
->statusCodeEquals(200);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.