From 17e1cc77e8505ff9f0368e6c1874f8f54df064fd Mon Sep 17 00:00:00 2001
From: "Theresa.Grannum" <theresa.grannum@3688861.no-reply.drupal.org>
Date: Tue, 31 May 2022 21:21:41 +0000
Subject: [PATCH] Issue #3271502 by Theresa.Grannum: Change internal mentions
 of "update version" to "target version"

---
 .../tests/src/Functional/UpdaterFormTest.php     | 16 ++++++++--------
 .../Validator/UpdateReleaseValidatorTest.php     | 10 +++++-----
 .../tests/src/Traits/FormTestTrait.php           |  8 ++++----
 src/CronUpdater.php                              | 12 ++++++------
 src/Form/UpdateReady.php                         |  2 +-
 src/Form/UpdaterForm.php                         |  4 ++--
 .../AutomaticUpdatesFunctionalTestBase.php       |  8 ++++----
 7 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php
index 396fa83765..6d56d9fde2 100644
--- a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php
+++ b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php
@@ -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');
diff --git a/automatic_updates_extensions/tests/src/Kernel/Validator/UpdateReleaseValidatorTest.php b/automatic_updates_extensions/tests/src/Kernel/Validator/UpdateReleaseValidatorTest.php
index 013cb6fa01..eea42e80b0 100644
--- a/automatic_updates_extensions/tests/src/Kernel/Validator/UpdateReleaseValidatorTest.php
+++ b/automatic_updates_extensions/tests/src/Kernel/Validator/UpdateReleaseValidatorTest.php
@@ -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);
   }
 
   /**
diff --git a/automatic_updates_extensions/tests/src/Traits/FormTestTrait.php b/automatic_updates_extensions/tests/src/Traits/FormTestTrait.php
index 802bc14859..33d4bd1005 100644
--- a/automatic_updates_extensions/tests/src/Traits/FormTestTrait.php
+++ b/automatic_updates_extensions/tests/src/Traits/FormTestTrait.php
@@ -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);
   }
 
diff --git a/src/CronUpdater.php b/src/CronUpdater.php
index 6f07e0255e..c5a4359f7f 100644
--- a/src/CronUpdater.php
+++ b/src/CronUpdater.php
@@ -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,
         ]
       );
     }
diff --git a/src/Form/UpdateReady.php b/src/Form/UpdateReady.php
index 1a0d628a8d..b91aec0ed9 100644
--- a/src/Form/UpdateReady.php
+++ b/src/Form/UpdateReady.php
@@ -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', [
diff --git a/src/Form/UpdaterForm.php b/src/Form/UpdaterForm.php
index c44d057d91..82977859cd 100644
--- a/src/Form/UpdaterForm.php
+++ b/src/Form/UpdaterForm.php
@@ -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'])
diff --git a/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php b/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php
index 47e042fbe3..80e5e554aa 100644
--- a/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php
+++ b/tests/src/Functional/AutomaticUpdatesFunctionalTestBase.php
@@ -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);
   }
 
 }
-- 
GitLab