Skip to content
Snippets Groups Projects

Issue #3276645: Run readiness checks after stored results have been cleared in certain situations

Merged Issue #3276645: Run readiness checks after stored results have been cleared in certain situations
1 file
+ 56
1
Compare changes
  • Side-by-side
  • Inline
@@ -702,7 +702,6 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->assertUpdateReady('9.8.1');
// Confirm that the site was put into maintenance mode if needed.
$this->assertMaintenanceMode($maintenance_mode_on);
TestSubscriber1::setTestResult([ValidationResult::createError(['Error before continue.'])], StatusCheckEvent::class);
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$assert_session->addressEquals('/admin/reports/updates');
@@ -721,7 +720,63 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->assertNotEmpty($pre_apply_time);
$this->assertNotEmpty($post_apply_time);
$this->assertNotSame($pre_apply_time, $post_apply_time);
}
/**
* Data provider for testStatusCheckerRunAfterUpdate().
*
* @return bool[][]
* The test cases.
*/
public function providerStatusCheckerRunAfterUpdate(): array {
return [
'has database updates' => [TRUE],
'does not have database updates' => [FALSE],
];
}
/**
* Tests status checks are run after an update.
*
* @param bool $has_database_updates
* Whether the site has database updates or not.
*
* @dataProvider providerStatusCheckerRunAfterUpdate
*/
public function testStatusCheckerRunAfterUpdate(bool $has_database_updates) {
$assert_session = $this->assertSession();
$this->setCoreVersion('9.8.0');
$this->checkForUpdates();
$page = $this->getSession()->getPage();
// Navigate to the automatic updates form.
$this->drupalGet('/admin/modules/update');
Stager::setFixturePath(__DIR__ . '/../../fixtures/drupal-9.8.1-installed');
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
$this->assertUpdateReady('9.8.1');
// Set an error before completing the update. This error should be visible
// on admin pages after completing the update without having to explicitly
// run the status checks.
TestSubscriber1::setTestResult([ValidationResult::createError(['Error before continue.'])], StatusCheckEvent::class);
if ($has_database_updates) {
// Simulate a staged database update in the automatic_updates_test module.
// We must do this after the update has started, because the pending updates
// validator will prevent an update from starting.
$this->container->get('state')->set('automatic_updates_test.new_update', TRUE);
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$this->assertSession()->addressEquals('/update.php');
}
else {
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$assert_session->addressEquals('/admin/reports/updates');
$assert_session->pageTextContainsOnce('Update complete!');
}
// Status checks should display errors on admin page.
$this->drupalGet('/admin');
// Confirm that the status checks were run and the new error is displayed.
$assert_session->pageTextContains('Error before continue.');
$assert_session->pageTextNotContains('Your site has not recently run an update readiness check. Run readiness checks now.');
}
Loading