diff --git a/automatic_updates_extensions/tests/fixtures/no_project/composer.json b/automatic_updates_extensions/tests/fixtures/no_project/composer.json deleted file mode 100644 index ea020c57542b148336fe112ea98f278bb655be2f..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/no_project/composer.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extra": { - "_readme": [ - "This fixture simulates a active directory in which, according to Composer, no module is installed." - ] - } -} diff --git a/automatic_updates_extensions/tests/fixtures/no_project/composer.lock b/automatic_updates_extensions/tests/fixtures/no_project/composer.lock deleted file mode 100644 index a453560509d23ab0b995b6e732cc92a1864f212f..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/no_project/composer.lock +++ /dev/null @@ -1,11 +0,0 @@ -{ - "packages": [ - { - "name": "drupal/core-recommended", - "version": "9.8.0", - "require": { - "drupal/core": "9.8.0" - } - } - ] -} diff --git a/automatic_updates_extensions/tests/fixtures/no_project/vendor/composer/installed.json b/automatic_updates_extensions/tests/fixtures/no_project/vendor/composer/installed.json deleted file mode 100644 index d4f0f343d72658dd2fb15964dba7ddf91705c509..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/no_project/vendor/composer/installed.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "packages": [ - { - "name": "drupal/core", - "version": "9.8.1", - "type": "drupal-core", - "extra": { - "drupal-scaffold": { - "file-mapping": {} - } - } - } - ] -} diff --git a/automatic_updates_extensions/tests/fixtures/one_project/composer.json b/automatic_updates_extensions/tests/fixtures/one_project/composer.json deleted file mode 100644 index 9e02b7d5132ebd3bde700b917432f2979af106a3..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/one_project/composer.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extra": { - "_readme": [ - "This fixture simulates a active directory in which, according to Composer, semver_test is installed." - ] - } -} diff --git a/automatic_updates_extensions/tests/fixtures/one_project/composer.lock b/automatic_updates_extensions/tests/fixtures/one_project/composer.lock deleted file mode 100644 index eb940f5c3512154711ae9107114a8e5be800ef68..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/one_project/composer.lock +++ /dev/null @@ -1,15 +0,0 @@ -{ - "packages": [ - { - "name": "drupal/core-recommended", - "version": "9.8.0", - "require": { - "drupal/core": "9.8.0" - } - }, - { - "name": "drupal/semver_test", - "version": "9.8.1" - } - ] -} diff --git a/automatic_updates_extensions/tests/fixtures/one_project/vendor/composer/installed.json b/automatic_updates_extensions/tests/fixtures/one_project/vendor/composer/installed.json deleted file mode 100644 index d3abd4518c826394ccdee9d63513cad656cf5d95..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/one_project/vendor/composer/installed.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "packages": [ - { - "name": "drupal/core", - "version": "9.8.1", - "type": "drupal-core", - "extra": { - "drupal-scaffold": { - "file-mapping": {} - } - } - }, - { - "name": "drupal/semver_test", - "version": "9.8.1", - "type": "drupal-module" - } - ] -} diff --git a/automatic_updates_extensions/tests/fixtures/two_projects/composer.json b/automatic_updates_extensions/tests/fixtures/two_projects/composer.json deleted file mode 100644 index 2981dea83e9286a6f6cf36c45e61acb8bb1e19af..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/two_projects/composer.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extra": { - "_readme": [ - "This fixture simulates a active directory in which, according to Composer, semver_test and aaa_update_test are installed." - ] - } -} diff --git a/automatic_updates_extensions/tests/fixtures/two_projects/composer.lock b/automatic_updates_extensions/tests/fixtures/two_projects/composer.lock deleted file mode 100644 index 57457e08cd9ba5fb82bb203c2b3ceb9a29590f77..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/two_projects/composer.lock +++ /dev/null @@ -1,23 +0,0 @@ -{ - "packages": [ - { - "name": "drupal/core-recommended", - "version": "9.8.0", - "require": { - "drupal/core": "9.8.0" - } - }, - { - "name": "drupal/semver_test", - "version": "9.8.1" - }, - { - "name": "drupal/aaa_update_test", - "version": "9.8.1" - }, - { - "name": "drupal/automatic_updates_extensions_test_theme", - "version": "9.8.1" - } - ] -} diff --git a/automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.json b/automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.json deleted file mode 100644 index 436721dfab075b704b84d121483ed89fa8d4cde5..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "packages": [ - { - "name": "drupal/core", - "version": "9.8.1", - "type": "drupal-core", - "extra": { - "drupal-scaffold": { - "file-mapping": {} - } - } - }, - { - "name": "drupal/semver_test", - "version": "8.1.0", - "type": "drupal-module" - }, - { - "name": "drupal/aaa_update_test", - "version": "2.0.0", - "type": "drupal-module" - }, - { - "name": "drupal/automatic_updates_extensions_test_theme", - "version": "2.0.0", - "type": "drupal-theme" - } - ] -} diff --git a/automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.php b/automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.php deleted file mode 100644 index ab1ddd069be73687e5259b083112fbde0a0daec6..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -/** - * @file - */ - -$projects_dir = __DIR__ . '/../../web/projects'; -return [ - 'versions' => [ - 'drupal/automatic_updates_extensions_test_theme' => [ - 'type' => 'drupal-theme', - 'install_path' => $projects_dir . '/automatic_updates_extensions_test_theme', - ], - 'drupal/semver_test' => [ - 'type' => 'drupal-module', - 'install_path' => $projects_dir . '/semver_test', - ], - 'drupal/aaa_update_test' => [ - 'type' => 'drupal-module', - 'install_path' => $projects_dir . '/aaa_update_test', - ], - ], -]; diff --git a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php index 524d19f98730184fa6e7ed6a1e30c027006b238b..d0d4a8fa97d6caf28876b0ada167455c0dd52469 100644 --- a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php +++ b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php @@ -13,6 +13,7 @@ use Drupal\package_manager_test_validation\EventSubscriber\TestSubscriber; use Drupal\Tests\automatic_updates\Functional\AutomaticUpdatesFunctionalTestBase; use Drupal\Tests\automatic_updates\Traits\ValidationTestTrait; use Drupal\Tests\automatic_updates_extensions\Traits\FormTestTrait; +use Drupal\Tests\package_manager\Traits\FixtureUtilityTrait; use Drupal\Tests\package_manager\Traits\PackageManagerBypassTestTrait; /** @@ -25,6 +26,14 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { use ValidationTestTrait; use FormTestTrait; use PackageManagerBypassTestTrait; + use FixtureUtilityTrait; + + /** + * The path of the test project's active directory. + * + * @var string + */ + private $activeDir; /** * {@inheritdoc} @@ -75,9 +84,26 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { 'access site in maintenance mode', 'access administration pages', ]); - // We need this fixture as only projects installed via composer will show up - // on the form. - $this->useFixtureDirectoryAsActive(__DIR__ . '/../../fixtures/two_projects'); + $this->activeDir = $this->container->get('package_manager.path_locator')->getProjectRoot(); + $this->copyFixtureFilesTo(__DIR__ . '/../../fixtures/two_projects', $this->activeDir); + $this->addPackage($this->activeDir, [ + 'name' => 'drupal/semver_test', + 'version' => '8.1.0', + 'type' => 'drupal-module', + 'install_path' => '../../web/projects/semver_test', + ]); + $this->addPackage($this->activeDir, [ + 'name' => 'drupal/aaa_update_test', + 'version' => '2.0.0', + 'type' => 'drupal-module', + 'install_path' => '../../web/projects/aaa_update_test', + ]); + $this->addPackage($this->activeDir, [ + 'name' => 'drupal/automatic_updates_extensions_test_theme', + 'version' => '2.0.0', + 'type' => 'drupal-theme', + 'install_path' => '../../web/projects/automatic_updates_extensions_test_theme', + ]); $this->drupalLogin($user); $this->drupalPlaceBlock('local_tasks_block', ['primary' => TRUE]); } @@ -418,9 +444,8 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { 'semver_test' => '8.1.0', ] ); - // One module not installed through composer. - $this->useFixtureDirectoryAsActive(__DIR__ . '/../../fixtures/one_project'); + $this->removePackage($this->activeDir, 'drupal/aaa_update_test'); $assert = $this->assertSession(); $user = $this->createUser( [ @@ -436,7 +461,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->assertUpdatesCount(1); // Both of the modules not installed through composer. - $this->useFixtureDirectoryAsActive(__DIR__ . '/../../fixtures/no_project'); + $this->removePackage($this->activeDir, 'drupal/semver_test'); $this->getSession()->reload(); $assert->pageTextContains('Updates were found, but they must be performed manually. See the list of available updates for more information.'); $this->assertNoUpdates();