Skip to content
Snippets Groups Projects
Commit 17e1cc77 authored by Theresa Grannum's avatar Theresa Grannum Committed by Ted Bowman
Browse files

Issue #3271502 by Theresa.Grannum: Change internal mentions of "update version" to "target version"

parent e1dac5fb
No related branches found
No related tags found
No related merge requests found
......@@ -108,11 +108,11 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* The expected project title.
* @param string $expected_installed_version
* The expected installed version.
* @param string $expected_update_version
* The expected update version.
* @param string $expected_target_version
* The expected target version.
*/
private function assertTableShowsUpdates(string $expected_project_title, string $expected_installed_version, string $expected_update_version): void {
$this->assertUpdateTableRow($this->assertSession(), $expected_project_title, $expected_installed_version, $expected_update_version);
private function assertTableShowsUpdates(string $expected_project_title, string $expected_installed_version, string $expected_target_version): void {
$this->assertUpdateTableRow($this->assertSession(), $expected_project_title, $expected_installed_version, $expected_target_version);
}
/**
......@@ -124,12 +124,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* The project name.
* @param string $installed_version
* The installed version.
* @param string $update_version
* The update version.
* @param string $target_version
* The target version.
*
* @dataProvider providerSuccessfulUpdate
*/
public function testSuccessfulUpdate(bool $maintenance_mode_on, string $project_name, string $installed_version, string $update_version): void {
public function testSuccessfulUpdate(bool $maintenance_mode_on, string $project_name, string $installed_version, string $target_version): void {
$this->updateProject = $project_name;
$this->setReleaseMetadata(__DIR__ . '/../../../../tests/fixtures/release-history/drupal.9.8.2.xml');
$this->setReleaseMetadata(__DIR__ . "/../../fixtures/release-history/$project_name.1.1.xml");
......@@ -145,7 +145,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->assertTableShowsUpdates(
$project_name === 'semver_test' ? 'Semver Test' : 'AAA Update test',
$installed_version,
$update_version
$target_version
);
$page->checkField('projects[' . $this->updateProject . ']');
$page->pressButton('Update');
......
......@@ -21,14 +21,14 @@ class UpdateReleaseValidatorTest extends AutomaticUpdatesExtensionsKernelTestBas
* The project to update.
* @param string $installed_version
* The installed version of the project.
* @param string $update_version
* The version to update to.
* @param string $target_version
* The target version.
* @param bool $error_expected
* Whether an error is expected in the update.
*
* @dataProvider providerTestRelease
*/
public function testRelease(string $project, string $installed_version, string $update_version, bool $error_expected) {
public function testRelease(string $project, string $installed_version, string $target_version, bool $error_expected) {
$this->enableModules([$project]);
$module_info = ['version' => $installed_version, 'project' => $project];
$this->config('update_test.settings')
......@@ -41,7 +41,7 @@ class UpdateReleaseValidatorTest extends AutomaticUpdatesExtensionsKernelTestBas
if ($error_expected) {
$expected_results = [
ValidationResult::createError(
["Project $project to version " . LegacyVersionUtility::convertToSemanticVersion($update_version)],
["Project $project to version " . LegacyVersionUtility::convertToSemanticVersion($target_version)],
t('Cannot update because the following project version is not in the list of installable releases.')
),
];
......@@ -50,7 +50,7 @@ class UpdateReleaseValidatorTest extends AutomaticUpdatesExtensionsKernelTestBas
$expected_results = [];
}
$this->assertUpdaterResults([$project => $update_version], $expected_results, PreCreateEvent::class);
$this->assertUpdaterResults([$project => $target_version], $expected_results, PreCreateEvent::class);
}
/**
......
......@@ -18,13 +18,13 @@ trait FormTestTrait {
* The expected project title.
* @param string $expected_installed_version
* The expected installed version.
* @param string $expected_update_version
* The expected update version.
* @param string $expected_target_version
* The expected target version.
*/
private function assertUpdateTableRow(WebAssert $assert, string $expected_project_title, string $expected_installed_version, string $expected_update_version): void {
private function assertUpdateTableRow(WebAssert $assert, string $expected_project_title, string $expected_installed_version, string $expected_target_version): void {
$assert->elementTextContains('css', '.update-recommended td:nth-of-type(2)', $expected_project_title);
$assert->elementTextContains('css', '.update-recommended td:nth-of-type(3)', $expected_installed_version);
$assert->elementTextContains('css', '.update-recommended td:nth-of-type(4)', $expected_update_version);
$assert->elementTextContains('css', '.update-recommended td:nth-of-type(4)', $expected_target_version);
$assert->elementsCount('css', '.update-recommended tbody tr', 1);
}
......
......@@ -109,13 +109,13 @@ class CronUpdater extends Updater {
/**
* Performs the update.
*
* @param string $update_version
* The version to which to update.
* @param string $target_version
* The target version.
* @param int|null $timeout
* How long to allow the operation to run before timing out, in seconds, or
* NULL to never time out.
*/
private function performUpdate(string $update_version, ?int $timeout): void {
private function performUpdate(string $target_version, ?int $timeout): void {
$installed_version = (new ProjectInfo('drupal'))->getInstalledVersion();
if (empty($installed_version)) {
$this->logger->error('Unable to determine the current version of Drupal core.');
......@@ -126,15 +126,15 @@ class CronUpdater extends Updater {
// handle any exceptions or validation errors consistently, and destroy the
// stage regardless of whether the update succeeds.
try {
$this->begin(['drupal' => $update_version], $timeout);
$this->begin(['drupal' => $target_version], $timeout);
$this->stage();
$this->apply();
$this->logger->info(
'Drupal core has been updated from %previous_version to %update_version',
'Drupal core has been updated from %previous_version to %target_version',
[
'%previous_version' => $installed_version,
'%update_version' => $update_version,
'%target_version' => $target_version,
]
);
}
......
......@@ -153,7 +153,7 @@ class UpdateReady extends FormBase {
return $form;
}
$form['update_version'] = [
$form['target_version'] = [
'#type' => 'html_tag',
'#tag' => 'p',
'#value' => $this->t('Drupal core will be updated to %version', [
......
......@@ -171,7 +171,7 @@ class UpdaterForm extends FormBase {
return $form;
}
$form['update_version'] = [
$form['target_version'] = [
'#type' => 'value',
'#value' => [
'drupal' => $recommended_release->getVersion(),
......@@ -301,7 +301,7 @@ class UpdaterForm extends FormBase {
->setInitMessage($this->t('Preparing to download updates'))
->addOperation(
[BatchProcessor::class, 'begin'],
[$form_state->getValue('update_version')]
[$form_state->getValue('target_version')]
)
->addOperation([BatchProcessor::class, 'stage'])
->setFinishCallback([BatchProcessor::class, 'finishStage'])
......
......@@ -160,13 +160,13 @@ abstract class AutomaticUpdatesFunctionalTestBase extends BrowserTestBase {
/**
* Asserts that we are on the "update ready" form.
*
* @param string $update_version
* The version of Drupal core that we are updating to.
* @param string $target_version
* The target version of Drupal core.
*/
protected function assertUpdateReady(string $update_version): void {
protected function assertUpdateReady(string $target_version): void {
$assert_session = $this->assertSession();
$assert_session->addressMatches('/\/admin\/automatic-update-ready\/[a-zA-Z0-9_\-]+$/');
$assert_session->pageTextContainsOnce('Drupal core will be updated to ' . $update_version);
$assert_session->pageTextContainsOnce('Drupal core will be updated to ' . $target_version);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment