Skip to content
Snippets Groups Projects
Commit c156058e authored by Yash Rode's avatar Yash Rode Committed by Ted Bowman
Browse files

Issue #3328516 by yash.rode, tedbow, Wim Leers: Remove...

Issue #3328516 by yash.rode, tedbow, Wim Leers: Remove AutomaticUpdatesFunctionalTestBase::setCoreUpdate() in favor of StageFixtureManipulator
parent 03a13db2
No related branches found
No related tags found
1 merge request!632Issue #3328516: Deprecate AutomaticUpdatesFunctionalTestBase::setCoreUpdate()
......@@ -33,18 +33,6 @@ abstract class AutomaticUpdatesFunctionalTestBase extends BrowserTestBase {
'package_manager_bypass',
];
/**
* Set the core update version.
*
* @param string $version
* The core version.
*/
protected function setCoreUpdate(string $version): void {
$stage_manipulator = new StageFixtureManipulator();
$stage_manipulator->setCorePackageVersion($version)
->setReadyToCommit();
}
/**
* The service IDs of any validators to disable.
*
......
......@@ -11,6 +11,7 @@ use Drupal\automatic_updates_test\Datetime\TestTime;
use Drupal\automatic_updates_test\EventSubscriber\TestSubscriber1;
use Drupal\automatic_updates_test2\EventSubscriber\TestSubscriber2;
use Drupal\Core\Url;
use Drupal\fixture_manipulator\StageFixtureManipulator;
use Drupal\package_manager\Event\StatusCheckEvent;
use Drupal\package_manager_test_validation\EventSubscriber\TestSubscriber;
use Drupal\system\SystemManager;
......@@ -469,6 +470,9 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
* Tests that stored validation results are deleted after an update.
*/
public function testStoredResultsClearedAfterUpdate(): void {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$assert_session = $this->assertSession();
$page = $this->getSession()->getPage();
$this->drupalLogin($this->checkerRunnerUser);
......@@ -500,7 +504,6 @@ class StatusCheckTest extends AutomaticUpdatesFunctionalTestBase {
// status check (without storing the results), and the checker is no
// longer raising an error.
$this->drupalGet('/admin/modules/update');
$this->setCoreUpdate('9.8.1');
$assert_session->buttonExists('Update to 9.8.1');
// Ensure that the previous results are still displayed on another admin
// page, to confirm that the updater form is not discarding the previous
......
......@@ -4,6 +4,8 @@ declare(strict_types = 1);
namespace Drupal\Tests\automatic_updates\Functional;
use Drupal\fixture_manipulator\StageFixtureManipulator;
/**
* Tests that only one Automatic Update operation can be performed at a time.
*
......@@ -42,6 +44,9 @@ class UpdateLockTest extends AutomaticUpdatesFunctionalTestBase {
* Tests that only user who started an update can continue through it.
*/
public function testLock(): void {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$page = $this->getSession()->getPage();
$assert_session = $this->assertSession();
$this->setCoreVersion('9.8.0');
......@@ -53,7 +58,6 @@ class UpdateLockTest extends AutomaticUpdatesFunctionalTestBase {
// We should be able to get partway through an update without issue.
$this->drupalLogin($user_1);
$this->drupalGet('/admin/modules/update');
$this->setCoreUpdate('9.8.1');
$page->pressButton('Update');
$this->checkForMetaRefresh();
$this->assertUpdateReady('9.8.1');
......
......@@ -452,6 +452,9 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* Tests deleting an existing update.
*/
public function testDeleteExistingUpdate(): void {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$conflict_message = 'Cannot begin an update because another Composer operation is currently in progress.';
$cancelled_message = 'The update was successfully cancelled.';
......@@ -461,7 +464,6 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$this->checkForUpdates();
$this->drupalGet('/admin/modules/update');
$this->setCoreUpdate('9.8.1');
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
......@@ -580,6 +582,9 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* @requires PHP >= 8.0
*/
public function testStagedDatabaseUpdates(bool $maintenance_mode_on): void {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$this->setCoreVersion('9.8.0');
$this->checkForUpdates();
$this->container->get('theme_installer')->install(['automatic_updates_theme_with_updates']);
......@@ -598,7 +603,6 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$page = $this->getSession()->getPage();
$this->drupalGet('/admin/modules/update');
$this->setCoreUpdate('9.8.1');
// The warning should be visible.
$assert_session = $this->assertSession();
$assert_session->pageTextContains(reset($messages));
......@@ -698,6 +702,9 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* @dataProvider providerSuccessfulUpdate
*/
public function testSuccessfulUpdate(string $update_form_url, bool $maintenance_mode_on): void {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$assert_session = $this->assertSession();
$this->setCoreVersion('9.8.0');
$this->checkForUpdates();
......@@ -707,7 +714,6 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$cached_message = $this->setAndAssertCachedMessage();
$this->drupalGet($update_form_url);
$this->setCoreUpdate('9.8.1');
$assert_session->pageTextNotContains($cached_message);
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
......@@ -759,13 +765,15 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* @requires PHP >= 8.0
*/
public function testStatusCheckerRunAfterUpdate(bool $has_database_updates) {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$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');
$this->setCoreUpdate('9.8.1');
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
......@@ -837,6 +845,9 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* @dataProvider providerUpdateCompleteMessage
*/
public function testUpdateCompleteMessage(bool $maintenance_mode_on): void {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$assert_session = $this->assertSession();
$this->setCoreVersion('9.8.0');
$this->checkForUpdates();
......@@ -845,7 +856,6 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
$page = $this->getSession()->getPage();
$this->drupalGet('/admin/modules/automatic-update');
$this->setCoreUpdate('9.8.1');
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
// Confirm that the site was put into maintenance mode if needed.
......@@ -861,12 +871,14 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
* Tests what happens when a staged update is deleted without being destroyed.
*/
public function testStagedUpdateDeletedImproperly(): void {
(new StageFixtureManipulator())
->setCorePackageVersion('9.8.1')
->setReadyToCommit();
$this->setCoreVersion('9.8.0');
$this->checkForUpdates();
$page = $this->getSession()->getPage();
$this->drupalGet('/admin/modules/update');
$this->setCoreUpdate('9.8.1');
$page->pressButton('Update to 9.8.1');
$this->checkForMetaRefresh();
$this->assertUpdateStagedTimes(1);
......
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