From 07f987bd0b7a80b38559c602494d54c62dfd1f6a Mon Sep 17 00:00:00 2001 From: phenaproxima <phenaproxima@205645.no-reply.drupal.org> Date: Tue, 8 Feb 2022 20:11:36 +0000 Subject: [PATCH] Issue #3260666 by phenaproxima: Readiness checks should not be shown on UpdateReady form --- src/Form/UpdaterForm.php | 2 +- tests/src/Functional/UpdaterFormTest.php | 29 ++++++++++++++---------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Form/UpdaterForm.php b/src/Form/UpdaterForm.php index bf9b0cf0da..eb93cfd881 100644 --- a/src/Form/UpdaterForm.php +++ b/src/Form/UpdaterForm.php @@ -198,7 +198,7 @@ class UpdaterForm extends FormBase { ], ]; - if ($form_state->isSubmitted()) { + if ($form_state->getUserInput()) { $results = []; } else { diff --git a/tests/src/Functional/UpdaterFormTest.php b/tests/src/Functional/UpdaterFormTest.php index 455b64c848..df86694b79 100644 --- a/tests/src/Functional/UpdaterFormTest.php +++ b/tests/src/Functional/UpdaterFormTest.php @@ -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(); $this->drupalGet('/admin/modules/automatic-update'); + // The warning should be visible. + $assert_session = $this->assertSession(); + $assert_session->pageTextContains(reset($messages)); $page->pressButton('Update'); $this->checkForMetaRefresh(); $this->assertUpdateStagedTimes(1); $this->assertUpdateReady(); - // We should see a warning about pending database updates, and once the - // staged changes have been applied, we should be redirected to update.php. - $assert_session = $this->assertSession(); + // The warning from the updater form should be not be repeated, but we + // should see a warning about pending database updates, and once the staged + // 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.'; $assert_session->pageTextContains($possible_update_message); $assert_session->pageTextContains('System'); $page->pressButton('Continue'); $this->checkForMetaRefresh(); $assert_session->addressEquals('/update.php'); + $assert_session->pageTextNotContains(reset($messages)); $assert_session->pageTextNotContains($possible_update_message); $assert_session->pageTextContainsOnce('Please apply database updates to complete the update process.'); } @@ -328,23 +341,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->setCoreVersion('9.8.0'); $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(); $this->drupalGet($update_form_url); - $assert_session = $this->assertSession(); - $assert_session->pageTextContains(reset($messages)); $page->pressButton('Update'); $this->checkForMetaRefresh(); $this->assertUpdateStagedTimes(1); $this->assertUpdateReady(); $page->pressButton('Continue'); $this->checkForMetaRefresh(); + $assert_session = $this->assertSession(); $assert_session->addressEquals('/admin/reports/updates'); $assert_session->pageTextContainsOnce('Update complete!'); } -- GitLab