Skip to content
Snippets Groups Projects
Commit 6f418d1f authored by omkar podey's avatar omkar podey Committed by Adam G-H
Browse files

Issue #3312085 by phenaproxima, omkar.podey, immaculatexavier: UpdateReady...

Issue #3312085 by phenaproxima, omkar.podey, immaculatexavier: UpdateReady hides the Continue button if StatusCheckEvent only returns warnings
parent 78afe634
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@ use Drupal\package_manager\Exception\ApplyFailedException;
use Drupal\package_manager\Event\StatusCheckEvent;
use Drupal\package_manager\Exception\StageException;
use Drupal\package_manager\Exception\StageOwnershipException;
use Drupal\system\SystemManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
......@@ -218,8 +219,11 @@ final class UpdateReady extends FormBase {
$this->eventDispatcher->dispatch($event);
/** @var \Drupal\package_manager\ValidationResult[] $results */
$results = $event->getResults();
if (!empty($results)) {
$this->displayResults($results, $this->messenger(), $this->renderer);
// This will have no effect if $results is empty.
$this->displayResults($results, $this->messenger(), $this->renderer);
// If any errors occurred, return the form early so the user cannot
// continue.
if ($this->getOverallSeverity($results) === SystemManager::REQUIREMENT_ERROR) {
return $form;
}
}
......
......@@ -781,6 +781,28 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$assert_session->buttonExists('Cancel update');
}
/**
* Tests that update can be completed even if a status check throws a warning.
*/
public function testContinueOnWarning(): void {
$session = $this->getSession();
$this->setCoreVersion('9.8.0');
$this->checkForUpdates();
$this->drupalGet('/admin/modules/automatic-update');
$session->getPage()->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$warning = ValidationResult::createWarning(['Some warning.']);
TestSubscriber::setTestResult([$warning], StatusCheckEvent::class);
$session->reload();
$assert_session = $this->assertSession();
$assert_session->buttonExists('Continue');
$assert_session->pageTextContains('Some warning.');
}
/**
* Sets an error message, runs readiness checks, and asserts it is displayed.
*
......
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