Skip to content
Snippets Groups Projects
Commit 9c6042f7 authored by Theresa Grannum's avatar Theresa Grannum Committed by Ted Bowman
Browse files

Issue #3277230 by kunal.sachdev, Theresa.Grannum, tedbow, capysara: Always run...

Issue #3277230 by kunal.sachdev, Theresa.Grannum, tedbow, capysara: Always run readiness checks on status report?
parent a251a3d9
No related branches found
No related tags found
No related merge requests found
......@@ -73,7 +73,7 @@ final class ReadinessRequirements implements ContainerInjectionInterface {
* Requirements arrays as specified by hook_requirements().
*/
public function getRequirements(): array {
$results = $this->readinessCheckerManager->runIfNoStoredResults()->getResults();
$results = $this->readinessCheckerManager->run()->getResults();
$requirements = [];
if (empty($results)) {
$requirements['automatic_updates_readiness'] = [
......
......@@ -76,9 +76,9 @@ class ReadinessValidationTest extends AutomaticUpdatesFunctionalTestBase {
public function testReadinessChecksStatusReport(): void {
$assert = $this->assertSession();
// Ensure automated_cron is disabled before installing automatic_updates. This
// ensures we are testing that automatic_updates runs the checkers when the
// module itself is installed and they weren't run on cron.
// Ensure automated_cron is disabled before installing automatic_updates.
// This ensures we are testing that automatic_updates runs the checkers when
// the module itself is installed and they weren't run on cron.
$this->assertFalse($this->container->get('module_handler')->moduleExists('automated_cron'));
$this->container->get('module_installer')->install(['automatic_updates', 'automatic_updates_test']);
......@@ -141,41 +141,37 @@ class ReadinessValidationTest extends AutomaticUpdatesFunctionalTestBase {
'warning' => $this->createValidationResult(SystemManager::REQUIREMENT_WARNING),
];
TestSubscriber1::setTestResult($expected_results, ReadinessCheckEvent::class);
$key_value->delete('readiness_validation_last_run');
// Confirm a new message is displayed if the stored messages are deleted.
$this->drupalGet('admin/reports/status');
// Confirm a new message is displayed if the page is reloaded.
$this->getSession()->reload();
// Confirm that on the status page if there is only 1 warning or error the
// the summaries will not be displayed.
// summaries will not be displayed.
$this->assertErrors([$expected_results['error']]);
$this->assertWarnings([$expected_results['warning']]);
$assert->pageTextNotContains($expected_results['error']->getSummary());
$assert->pageTextNotContains($expected_results['warning']->getSummary());
$key_value->delete('readiness_validation_last_run');
$expected_results = [
'error' => $this->createValidationResult(SystemManager::REQUIREMENT_ERROR, 2),
'warning' => $this->createValidationResult(SystemManager::REQUIREMENT_WARNING, 2),
];
TestSubscriber1::setTestResult($expected_results, ReadinessCheckEvent::class);
$this->drupalGet('admin/reports/status');
$this->getSession()->reload();
// Confirm that both messages and summaries will be displayed on status
// report when there multiple messages.
$this->assertErrors([$expected_results['error']]);
$this->assertWarnings([$expected_results['warning']]);
$key_value->delete('readiness_validation_last_run');
$expected_results = [$this->createValidationResult(SystemManager::REQUIREMENT_WARNING, 2)];
TestSubscriber1::setTestResult($expected_results, ReadinessCheckEvent::class);
$this->drupalGet('admin/reports/status');
$this->getSession()->reload();
$assert->pageTextContainsOnce('Update readiness checks');
// Confirm that warnings will display on the status report if there are no
// errors.
$this->assertWarnings($expected_results);
$key_value->delete('readiness_validation_last_run');
$expected_results = [$this->createValidationResult(SystemManager::REQUIREMENT_WARNING)];
TestSubscriber1::setTestResult($expected_results, ReadinessCheckEvent::class);
$this->drupalGet('admin/reports/status');
$this->getSession()->reload();
$assert->pageTextContainsOnce('Update readiness checks');
$this->assertWarnings($expected_results);
}
......
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