diff --git a/src/Validator/UpdateVersionValidator.php b/src/Validator/UpdateVersionValidator.php index b46d34a0dc5dab1af5f4d71f5c874f97fd37cacf..a824ab44fe204197b4a9e6dd8c0b3d194534631b 100644 --- a/src/Validator/UpdateVersionValidator.php +++ b/src/Validator/UpdateVersionValidator.php @@ -68,15 +68,19 @@ class UpdateVersionValidator implements EventSubscriberInterface { $event->addValidationResult($error); } elseif ($from_version->getMajorVersion() !== $to_version->getMajorVersion()) { - $error = ValidationResult::createError([ - $this->t('Updating from one major version to another is not supported.'), + $messages[] = $this->t('Drupal cannot be automatically updated from its current version, @from_version, to the recommended version, @to_version, because automatic updates from one major version to another are not supported.', [ + '@to_version' => $to_version_string, + '@from_version' => $from_version_string, ]); + $error = ValidationResult::createError($messages); $event->addValidationResult($error); } elseif ($from_version->getMinorVersion() !== $to_version->getMinorVersion()) { - $error = ValidationResult::createError([ - $this->t('Updating from one minor version to another is not supported.'), + $messages[] = $this->t('Drupal cannot be automatically updated from its current version, @from_version, to the recommended version, @to_version, because automatic updates from one minor version to another are not supported.', [ + '@from_version' => $this->getCoreVersion(), + '@to_version' => $event->getPackageVersions()[$core_package_name], ]); + $error = ValidationResult::createError($messages); $event->addValidationResult($error); } diff --git a/tests/fixtures/fake-site/.htaccess b/tests/fixtures/fake-site/.htaccess new file mode 100644 index 0000000000000000000000000000000000000000..14249c50bd7605225950b2d372f352a2dba9252a --- /dev/null +++ b/tests/fixtures/fake-site/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/tests/fixtures/fake-site/cache/.htaccess b/tests/fixtures/fake-site/cache/.htaccess new file mode 100644 index 0000000000000000000000000000000000000000..14249c50bd7605225950b2d372f352a2dba9252a --- /dev/null +++ b/tests/fixtures/fake-site/cache/.htaccess @@ -0,0 +1 @@ +Deny from all \ No newline at end of file diff --git a/tests/src/Functional/UpdaterFormTest.php b/tests/src/Functional/UpdaterFormTest.php index 193bc951ba28fe8274e41882decada8f7c83cccb..a5c486492bbba96e411bbd460dd24c3e5a7f9fda 100644 --- a/tests/src/Functional/UpdaterFormTest.php +++ b/tests/src/Functional/UpdaterFormTest.php @@ -224,11 +224,12 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { */ public function testMinorVersionUpdateNotSupported(string $update_form_url): void { $this->setCoreVersion('9.7.1'); + $this->checkForUpdates(); $this->drupalGet($update_form_url); $assert_session = $this->assertSession(); - $assert_session->pageTextContainsOnce('Updating from one minor version to another is not supported.'); + $assert_session->pageTextContainsOnce('Drupal cannot be automatically updated from its current version, 9.7.1, to the recommended version, 9.8.1, because automatic updates from one minor version to another are not supported.'); $assert_session->buttonNotExists('Update'); } diff --git a/tests/src/Kernel/ReadinessValidation/UpdateVersionValidatorTest.php b/tests/src/Kernel/ReadinessValidation/UpdateVersionValidatorTest.php index f4a1d06e82467216d7928da3c2f3b6d35409f6af..b98fb2027f22f87fc2a523565ec7d614ed65b3cb 100644 --- a/tests/src/Kernel/ReadinessValidation/UpdateVersionValidatorTest.php +++ b/tests/src/Kernel/ReadinessValidation/UpdateVersionValidatorTest.php @@ -32,7 +32,9 @@ class UpdateVersionValidatorTest extends AutomaticUpdatesKernelTestBase { */ public function testMajorUpdates(): void { $this->setCoreVersion('8.9.1'); - $result = ValidationResult::createError(['Updating from one major version to another is not supported.']); + $result = ValidationResult::createError([ + 'Drupal cannot be automatically updated from its current version, 8.9.1, to the recommended version, 9.8.1, because automatic updates from one major version to another are not supported.', + ]); $this->assertCheckerResultsFromManager([$result], TRUE); } @@ -42,7 +44,9 @@ class UpdateVersionValidatorTest extends AutomaticUpdatesKernelTestBase { */ public function testMinorUpdates(): void { $this->setCoreVersion('9.7.1'); - $result = ValidationResult::createError(['Updating from one minor version to another is not supported.']); + $result = ValidationResult::createError([ + 'Drupal cannot be automatically updated from its current version, 9.7.1, to the recommended version, 9.8.1, because automatic updates from one minor version to another are not supported.', + ]); $this->assertCheckerResultsFromManager([$result], TRUE); }