Skip to content
Snippets Groups Projects
Commit 97986f68 authored by Kunal Sachdev's avatar Kunal Sachdev Committed by Ted Bowman
Browse files

Issue #3244360 by kunal.sachdev: Add more context to UpdateVersionValidator error messages

parent c3930ce3
No related branches found
No related tags found
1 merge request!82Issue #3244360: Add more context to UpdateVersionValidator error messages
......@@ -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);
}
......
Deny from all
\ No newline at end of file
Deny from all
\ No newline at end of file
......@@ -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');
}
......
......@@ -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);
}
......
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