Skip to content
Snippets Groups Projects

Issue #3321684: Should most validators that subscribe to PreCreate check readiness to update also subscribe to PreApply?

Merged Issue #3321684: Should most validators that subscribe to PreCreate check readiness to update also subscribe to PreApply?
Compare and Show latest version
9 files
+ 261
21
Compare changes
  • Side-by-side
  • Inline
Files
9
@@ -5,6 +5,7 @@ declare(strict_types = 1);
namespace Drupal\Tests\automatic_updates_extensions\Functional;
use Drupal\automatic_updates_test\EventSubscriber\TestSubscriber1;
use Drupal\Core\Url;
use Drupal\package_manager_test_validation\StagedDatabaseUpdateValidator;
use Drupal\package_manager\Event\PreApplyEvent;
use Drupal\package_manager\Event\StatusCheckEvent;
@@ -295,8 +296,10 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->container->get('state')->set('automatic_updates_test.new_update', TRUE);
$page->pressButton('Continue');
$this->checkForMetaRefresh();
$assert_session->pageTextContains('Some modules have database schema updates to install. You should run the <a href="/update.php">database update script</a> immediately.');
$assert_session->pageTextContains('Some modules have database schema updates to install.');
$page->clickLink('the error page');
$assert_session->linkExists('database update script');
$assert_session->linkByHrefExists('/update.php');
$page->clickLink('database update script');
$this->assertSession()->addressEquals('/update.php');
$assert_session->pageTextNotContains('Possible database updates have been detected in the following extension');
@@ -306,19 +309,21 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$page->clickLink('Apply pending updates');
$this->checkForMetaRefresh();
$assert_session->pageTextContains('Updates were attempted.');
// PendingUpdatesValidator prevented the update to complete, so the status
// checks weren't run.
}
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->statusMessageContains('Error before continue.', 'error');
$assert_session->statusMessageContains(static::$errorsExplanation, 'error');
$assert_session->pageTextNotContains('Your site has not recently run an update readiness check. Run readiness checks now.');
}
// 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->statusMessageContains('Error before continue.', 'error');
$assert_session->statusMessageContains(static::$errorsExplanation, 'error');
$assert_session->pageTextNotContains('Your site has not recently run an update readiness check. Run readiness checks now.');
}
/**
Loading