diff --git a/automatic_updates_extensions/tests/fixtures/active_composer/no_project/composer.json b/automatic_updates_extensions/tests/fixtures/no_project/composer.json similarity index 100% rename from automatic_updates_extensions/tests/fixtures/active_composer/no_project/composer.json rename to automatic_updates_extensions/tests/fixtures/no_project/composer.json diff --git a/automatic_updates_extensions/tests/fixtures/no_project/composer.lock b/automatic_updates_extensions/tests/fixtures/no_project/composer.lock new file mode 100644 index 0000000000000000000000000000000000000000..a453560509d23ab0b995b6e732cc92a1864f212f --- /dev/null +++ b/automatic_updates_extensions/tests/fixtures/no_project/composer.lock @@ -0,0 +1,11 @@ +{ + "packages": [ + { + "name": "drupal/core-recommended", + "version": "9.8.0", + "require": { + "drupal/core": "9.8.0" + } + } + ] +} diff --git a/automatic_updates_extensions/tests/fixtures/active_composer/no_project/vendor/composer/installed.json b/automatic_updates_extensions/tests/fixtures/no_project/vendor/composer/installed.json similarity index 100% rename from automatic_updates_extensions/tests/fixtures/active_composer/no_project/vendor/composer/installed.json rename to automatic_updates_extensions/tests/fixtures/no_project/vendor/composer/installed.json diff --git a/automatic_updates_extensions/tests/fixtures/active_composer/one_project/composer.json b/automatic_updates_extensions/tests/fixtures/one_project/composer.json similarity index 100% rename from automatic_updates_extensions/tests/fixtures/active_composer/one_project/composer.json rename to automatic_updates_extensions/tests/fixtures/one_project/composer.json diff --git a/automatic_updates_extensions/tests/fixtures/one_project/composer.lock b/automatic_updates_extensions/tests/fixtures/one_project/composer.lock new file mode 100644 index 0000000000000000000000000000000000000000..eb940f5c3512154711ae9107114a8e5be800ef68 --- /dev/null +++ b/automatic_updates_extensions/tests/fixtures/one_project/composer.lock @@ -0,0 +1,15 @@ +{ + "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/active_composer/one_project/vendor/composer/installed.json b/automatic_updates_extensions/tests/fixtures/one_project/vendor/composer/installed.json similarity index 100% rename from automatic_updates_extensions/tests/fixtures/active_composer/one_project/vendor/composer/installed.json rename to automatic_updates_extensions/tests/fixtures/one_project/vendor/composer/installed.json diff --git a/automatic_updates_extensions/tests/fixtures/active_composer/two_projects/composer.json b/automatic_updates_extensions/tests/fixtures/two_projects/composer.json similarity index 100% rename from automatic_updates_extensions/tests/fixtures/active_composer/two_projects/composer.json rename to automatic_updates_extensions/tests/fixtures/two_projects/composer.json diff --git a/automatic_updates_extensions/tests/fixtures/two_projects/composer.lock b/automatic_updates_extensions/tests/fixtures/two_projects/composer.lock new file mode 100644 index 0000000000000000000000000000000000000000..51df43c0cc65a352cb90e664333227a0065acac0 --- /dev/null +++ b/automatic_updates_extensions/tests/fixtures/two_projects/composer.lock @@ -0,0 +1,19 @@ +{ + "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" + } + ] +} diff --git a/automatic_updates_extensions/tests/fixtures/active_composer/two_projects/vendor/composer/installed.json b/automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.json similarity index 100% rename from automatic_updates_extensions/tests/fixtures/active_composer/two_projects/vendor/composer/installed.json rename to automatic_updates_extensions/tests/fixtures/two_projects/vendor/composer/installed.json diff --git a/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/automatic_updates_extensions_test.info.yml b/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/automatic_updates_extensions_test.info.yml deleted file mode 100644 index 911c33c6ca3aecf21c70acb75145f5cfed8f4dee..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/automatic_updates_extensions_test.info.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: 'Automatic Updates Extensions Test' -description: 'Automatic Updates Extensions Test module' -type: module -package: Testing -dependencies: - - automatic_updates:automatic_updates_extensions diff --git a/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/src/AutomaticUpdatesExtensionsTestServiceProvider.php b/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/src/AutomaticUpdatesExtensionsTestServiceProvider.php deleted file mode 100644 index e5797a5b2e941828425ec311b54970be5b86d3b0..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/src/AutomaticUpdatesExtensionsTestServiceProvider.php +++ /dev/null @@ -1,24 +0,0 @@ -<?php - -namespace Drupal\automatic_updates_extensions_test; - -use Drupal\Core\DependencyInjection\ContainerBuilder; -use Drupal\Core\DependencyInjection\ServiceModifierInterface; - -/** - * Service provider to use test updater service. - */ -class AutomaticUpdatesExtensionsTestServiceProvider implements ServiceModifierInterface { - - /** - * {@inheritdoc} - */ - public function alter(ContainerBuilder $container) { - if ($container->hasDefinition('automatic_updates_extensions.updater')) { - $container->getDefinition('automatic_updates_extensions.updater') - ->setClass(TestExtensionUpdater::class); - - } - } - -} diff --git a/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/src/TestExtensionUpdater.php b/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/src/TestExtensionUpdater.php deleted file mode 100644 index 8746ae800b77cf35fd3856fbd811ae44b1ddd148..0000000000000000000000000000000000000000 --- a/automatic_updates_extensions/tests/modules/automatic_updates_extensions_test/src/TestExtensionUpdater.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php - -namespace Drupal\automatic_updates_extensions_test; - -use Drupal\automatic_updates_extensions\ExtensionUpdater; -use Drupal\package_manager\ComposerUtility; - -/** - * Extends the updater to point to a fixture directory for the active Composer. - */ -class TestExtensionUpdater extends ExtensionUpdater { - - /** - * {@inheritdoc} - */ - public function getActiveComposer(): ComposerUtility { - if ($path = \Drupal::state()->get('automatic_updates_extensions_test.active_path')) { - return ComposerUtility::createForDirectory($path); - } - return parent::getActiveComposer(); - } - -} diff --git a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php index 5e47f55a6cb03fecedacc3adec8c79c2e6c6415e..a621711ae6463cdd613ae362d838982b458fdf00 100644 --- a/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php +++ b/automatic_updates_extensions/tests/src/Functional/UpdaterFormTest.php @@ -35,7 +35,6 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { protected static $modules = [ 'automatic_updates_test', 'automatic_updates_extensions', - 'automatic_updates_extensions_test', 'block', 'semver_test', 'aaa_update_test', @@ -78,7 +77,10 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { ]); // We need this fixture as only projects installed via composer will show up // on the form. - $this->container->get('state')->set('automatic_updates_extensions_test.active_path', __DIR__ . '/../../fixtures/active_composer/two_projects'); + $fixture_dir = __DIR__ . '/../../fixtures/two_projects'; + Beginner::setFixturePath($fixture_dir); + $this->container->get('package_manager.path_locator') + ->setPaths($fixture_dir, $fixture_dir . '/vendor', ''); $this->drupalLogin($user); $this->drupalPlaceBlock('local_tasks_block', ['primary' => TRUE]); } @@ -163,8 +165,6 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->checkForUpdates(); $state = $this->container->get('state'); $state->set('system.maintenance_mode', $maintenance_mode_on); - - Beginner::setFixturePath(__DIR__ . '/../../fixtures/fake-site'); StagedDatabaseUpdateValidator::setExtensionsWithUpdates(['system', 'automatic_updates_theme_with_updates']); $page = $this->getSession()->getPage(); @@ -216,13 +216,16 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { ->save(); $this->setProjectInstalledVersion( [ - 'aaa_update_test' => '8.x-2.x', + 'aaa_update_test' => '8.x-2.0', 'semver_test' => '8.1.0', ] ); // One module not installed through composer. - $this->container->get('state')->set('automatic_updates_extensions_test.active_path', __DIR__ . '/../../fixtures/active_composer/one_project'); + $fixture_dir = __DIR__ . '/../../fixtures/one_project'; + Beginner::setFixturePath($fixture_dir); + $this->container->get('package_manager.path_locator') + ->setPaths($fixture_dir, $fixture_dir . '/vendor', ''); $assert = $this->assertSession(); $user = $this->createUser( [ @@ -237,7 +240,10 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $this->assertTableShowsUpdates('Semver Test', '8.1.0', '8.1.1'); // Both of the modules not installed through composer. - $this->container->get('state')->set('automatic_updates_extensions_test.active_path', __DIR__ . '/../../fixtures/active_composer/no_project'); + $fixture_dir = __DIR__ . '/../../fixtures/no_project'; + Beginner::setFixturePath($fixture_dir); + $this->container->get('package_manager.path_locator') + ->setPaths($fixture_dir, $fixture_dir . '/vendor', ''); $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();