Skip to content
Snippets Groups Projects
Commit a23cfa2e authored by omkar podey's avatar omkar podey Committed by Ted Bowman
Browse files

Issue #3313346 by omkar.podey, tedbow: UpdateReady is not displaying all the...

Issue #3313346 by omkar.podey, tedbow: UpdateReady is not displaying all the messages for statusCheck validation results
parent 850f2bb4
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ namespace Drupal\automatic_updates\Form;
use Drupal\automatic_updates\BatchProcessor;
use Drupal\automatic_updates\Updater;
use Drupal\automatic_updates\Validation\ReadinessTrait;
use Drupal\package_manager\ValidationResult;
use Drupal\package_manager\Validator\StagedDBUpdateValidator;
use Drupal\Core\Batch\BatchBuilder;
use Drupal\Core\Extension\ModuleExtensionList;
......@@ -29,7 +30,9 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
*/
final class UpdateReady extends FormBase {
use ReadinessTrait;
use ReadinessTrait {
formatResult as traitFormatResult;
}
/**
* The updater service.
......@@ -274,4 +277,22 @@ final class UpdateReady extends FormBase {
}
}
/**
* {@inheritdoc}
*
* @todo Remove this in https://www.drupal.org/project/automatic_updates/issues/3313414.
*/
protected function formatResult(ValidationResult $result) {
$messages = $result->getMessages();
if (count($messages) > 1) {
return [
'#theme' => 'item_list__automatic_updates_validation_results',
'#prefix' => $result->getSummary(),
'#items' => $messages,
];
}
return $this->traitFormatResult($result);
}
}
......@@ -774,9 +774,20 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$error = ValidationResult::createError(['Error occured.']);
$error_messages = [
"The only thing we're allowed to do is to",
"believe that we won't regret the choice",
"we made.",
];
$summary = t('some generic summary');
$error = ValidationResult::createError($error_messages, $summary);
TestSubscriber::setTestResult([$error], StatusCheckEvent::class);
$this->getSession()->reload();
$assert_session->pageTextContains($summary);
foreach ($error_messages as $message) {
$assert_session->pageTextContains($message);
}
$assert_session->buttonNotExists('Continue');
$assert_session->buttonExists('Cancel update');
}
......@@ -794,13 +805,22 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$warning = ValidationResult::createWarning(['Some warning.']);
$messages = [
"The only thing we're allowed to do is to",
"believe that we won't regret the choice",
"we made.",
];
$summary = t('some generic summary');
$warning = ValidationResult::createWarning($messages, $summary);
TestSubscriber::setTestResult([$warning], StatusCheckEvent::class);
$session->reload();
$assert_session = $this->assertSession();
$assert_session->buttonExists('Continue');
$assert_session->pageTextContains('Some warning.');
$assert_session->pageTextContains($summary);
foreach ($messages as $message) {
$assert_session->pageTextContains($message);
}
}
/**
......
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