Skip to content
Snippets Groups Projects
Commit 07f987bd authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3260666 by phenaproxima: Readiness checks should not be shown on UpdateReady form

parent b67915ce
No related branches found
No related tags found
No related merge requests found
...@@ -198,7 +198,7 @@ class UpdaterForm extends FormBase { ...@@ -198,7 +198,7 @@ class UpdaterForm extends FormBase {
], ],
]; ];
if ($form_state->isSubmitted()) { if ($form_state->getUserInput()) {
$results = []; $results = [];
} }
else { else {
......
...@@ -297,21 +297,34 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -297,21 +297,34 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
], ],
]); ]);
// Flag a warning, which will not block the update but should be displayed
// on the updater form.
$this->createTestValidationResults();
$expected_results = $this->testResults['checker_1']['1 warning'];
TestChecker1::setTestResult($expected_results, ReadinessCheckEvent::class);
$messages = reset($expected_results)->getMessages();
$page = $this->getSession()->getPage(); $page = $this->getSession()->getPage();
$this->drupalGet('/admin/modules/automatic-update'); $this->drupalGet('/admin/modules/automatic-update');
// The warning should be visible.
$assert_session = $this->assertSession();
$assert_session->pageTextContains(reset($messages));
$page->pressButton('Update'); $page->pressButton('Update');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1); $this->assertUpdateStagedTimes(1);
$this->assertUpdateReady(); $this->assertUpdateReady();
// We should see a warning about pending database updates, and once the // The warning from the updater form should be not be repeated, but we
// staged changes have been applied, we should be redirected to update.php. // should see a warning about pending database updates, and once the staged
$assert_session = $this->assertSession(); // changes have been applied, we should be redirected to update.php, where
// neither warning should be visible.
$assert_session->pageTextNotContains(reset($messages));
$possible_update_message = 'Possible database updates were detected in the following modules; you may be redirected to the database update page in order to complete the update process.'; $possible_update_message = 'Possible database updates were detected in the following modules; you may be redirected to the database update page in order to complete the update process.';
$assert_session->pageTextContains($possible_update_message); $assert_session->pageTextContains($possible_update_message);
$assert_session->pageTextContains('System'); $assert_session->pageTextContains('System');
$page->pressButton('Continue'); $page->pressButton('Continue');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$assert_session->addressEquals('/update.php'); $assert_session->addressEquals('/update.php');
$assert_session->pageTextNotContains(reset($messages));
$assert_session->pageTextNotContains($possible_update_message); $assert_session->pageTextNotContains($possible_update_message);
$assert_session->pageTextContainsOnce('Please apply database updates to complete the update process.'); $assert_session->pageTextContainsOnce('Please apply database updates to complete the update process.');
} }
...@@ -328,23 +341,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { ...@@ -328,23 +341,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->setCoreVersion('9.8.0'); $this->setCoreVersion('9.8.0');
$this->checkForUpdates(); $this->checkForUpdates();
// Flag a warning, which will not block the update but should be displayed
// on the updater form.
$this->createTestValidationResults();
$expected_results = $this->testResults['checker_1']['1 warning'];
TestChecker1::setTestResult($expected_results, ReadinessCheckEvent::class);
$messages = reset($expected_results)->getMessages();
$page = $this->getSession()->getPage(); $page = $this->getSession()->getPage();
$this->drupalGet($update_form_url); $this->drupalGet($update_form_url);
$assert_session = $this->assertSession();
$assert_session->pageTextContains(reset($messages));
$page->pressButton('Update'); $page->pressButton('Update');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1); $this->assertUpdateStagedTimes(1);
$this->assertUpdateReady(); $this->assertUpdateReady();
$page->pressButton('Continue'); $page->pressButton('Continue');
$this->checkForMetaRefresh(); $this->checkForMetaRefresh();
$assert_session = $this->assertSession();
$assert_session->addressEquals('/admin/reports/updates'); $assert_session->addressEquals('/admin/reports/updates');
$assert_session->pageTextContainsOnce('Update complete!'); $assert_session->pageTextContainsOnce('Update complete!');
} }
......
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