From 73ce755552d9a1fe8b4492d09e1ea803097cc745 Mon Sep 17 00:00:00 2001
From: Adam G-H <32250-phenaproxima@users.noreply.drupalcode.org>
Date: Fri, 20 Sep 2024 21:53:57 +0000
Subject: [PATCH] Issue #3475847 by phenaproxima: Expose a zip file that can be
 used to start a real Drupal CMS project

---
 .ddev/commands/web/unpack                     | 38 +++++++++++++++++++
 .gitlab-ci.yml                                | 14 ++++++-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 drupal_cms_installer/composer.json            |  5 ---
 .../drupal_cms_installer.profile              |  5 +++
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 .../src/Kernel/ComponentValidationTest.php    |  3 +-
 24 files changed, 76 insertions(+), 46 deletions(-)
 create mode 100755 .ddev/commands/web/unpack

diff --git a/.ddev/commands/web/unpack b/.ddev/commands/web/unpack
new file mode 100755
index 000000000..305bd932a
--- /dev/null
+++ b/.ddev/commands/web/unpack
@@ -0,0 +1,38 @@
+#!/usr/bin/env sh
+
+## Description: Unpacks all recipes' dependencies into the main `composer.json`.
+## Usage: unpack
+## Example: "ddev unpack"
+## Example: "ddev unpack /path/to/project"
+
+# Stop this entire script if any one command fails.
+set -e
+
+# Assume all recipes are located in the current directory.
+recipes=$(find . -maxdepth 1 -type d -name 'drupal_cms*' -printf "drupal/%P\n")
+
+# If a path to the built code base was passed (currently used by our CI process),
+# switch to it.
+test -z "$1" || cd $1
+
+# Configure and install the unpack plugin.
+composer config allow-plugins.ewcomposer/unpack true
+composer config repositories.unpack vcs https://gitlab.ewdev.ca/yonas.legesse/drupal-recipe-unpack.git
+composer require --dev ewcomposer/unpack:dev-master
+
+# First, unpack all the dependencies. Since recipes can depend on other recipes, we
+# need to do this step separately from removing the recipes.
+for name in $recipes; do
+  composer unpack $name
+  echo "Unpacked $name"
+done
+
+# Now that everything is unpacked, we can remove all the recipes from `composer.json`.
+for name in $recipes; do
+  composer remove --quiet --no-update $name
+done
+
+# Remove the unpacked recipes, along with the unpack plugin itself.
+composer remove --minimal-changes --dev ewcomposer/unpack
+composer config --unset allow-plugins.ewcomposer/unpack
+composer config --unset repositories.unpack
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e2af75e92..c81c1cd3e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,9 +32,19 @@ build project:
     - composer config --global repositories.template path $CI_PROJECT_DIR/project_template
     # Create the project.
     - composer create-project drupal/drupal-cms-project $_PROJECT_ROOT --stability=dev
+  after_script:
+    # Turn the built project into an archive that can be downloaded by the public
+    # to spin up projects with Drupal CMS. For now, this means that the recipes and
+    # installer need to NOT be managed by Composer at all. We can remove this kludge
+    # when all of our components are available on Packagist.
+    - .ddev/commands/web/unpack $_PROJECT_ROOT
+    - cd $_PROJECT_ROOT/$_WEB_ROOT
+    - mkdir -p ./profiles/contrib && mv $CI_PROJECT_DIR/drupal_cms_installer ./profiles/contrib
+    - mkdir recipes && mv $CI_PROJECT_DIR/drupal_cms* recipes
+    - composer archive --format=zip --file=drupal-cms --dir=$CI_PROJECT_DIR --working-dir=$_PROJECT_ROOT
   artifacts:
     paths:
-      - project
+      - drupal-cms.zip
     expire_in: 1 hour
   rules:
     - when: on_success
@@ -62,6 +72,8 @@ run tests:
   stage: test
   needs:
     - 'build project'
+  before_script:
+    - unzip -q -d $_PROJECT_ROOT drupal-cms.zip
   script:
     - service apache2 start
     - cd /var/www/html
diff --git a/drupal_cms/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms/tests/src/Kernel/ComponentValidationTest.php
index 938eb3e53..82b4883f7 100644
--- a/drupal_cms/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_accessibility_tools/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_accessibility_tools/tests/src/Kernel/ComponentValidationTest.php
index 2d4a3e11e..0f6d6ddd4 100644
--- a/drupal_cms_accessibility_tools/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_accessibility_tools/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_accessibility_tools\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_admin_theme/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_admin_theme/tests/src/Kernel/ComponentValidationTest.php
index 47e613ba5..546956e17 100644
--- a/drupal_cms_admin_theme/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_admin_theme/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_admin_theme\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_anti_spam/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_anti_spam/tests/src/Kernel/ComponentValidationTest.php
index a70ced1f6..670c5df14 100644
--- a/drupal_cms_anti_spam/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_anti_spam/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_anti_spam\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_basic_html_editor/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_basic_html_editor/tests/src/Kernel/ComponentValidationTest.php
index a75746176..f99871dad 100644
--- a/drupal_cms_basic_html_editor/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_basic_html_editor/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_basic_html_editor\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_blog/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_blog/tests/src/Kernel/ComponentValidationTest.php
index 775c394a1..a332fc4a8 100644
--- a/drupal_cms_blog/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_blog/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_blog\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_content_type_base/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_content_type_base/tests/src/Kernel/ComponentValidationTest.php
index fdc4ca431..cf2d0dcf8 100644
--- a/drupal_cms_content_type_base/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_content_type_base/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_content_type_base\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_dashboard/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_dashboard/tests/src/Kernel/ComponentValidationTest.php
index 29724bce9..c9a9d1abf 100644
--- a/drupal_cms_dashboard/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_dashboard/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_dashboard\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_events/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_events/tests/src/Kernel/ComponentValidationTest.php
index c878de307..27aba6204 100644
--- a/drupal_cms_events/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_events/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_events\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_forms/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_forms/tests/src/Kernel/ComponentValidationTest.php
index e5c3112a2..0d8c17554 100644
--- a/drupal_cms_forms/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_forms/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_forms\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_full_html_editor/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_full_html_editor/tests/src/Kernel/ComponentValidationTest.php
index 9fff45a0a..0d58f19d3 100644
--- a/drupal_cms_full_html_editor/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_full_html_editor/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_full_html_editor\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_image_media_type/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_image_media_type/tests/src/Kernel/ComponentValidationTest.php
index f7f08ce53..f6a03f7b9 100644
--- a/drupal_cms_image_media_type/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_image_media_type/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_image_media_type\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_installer/composer.json b/drupal_cms_installer/composer.json
index 0070e0180..9fc5bcde0 100644
--- a/drupal_cms_installer/composer.json
+++ b/drupal_cms_installer/composer.json
@@ -5,10 +5,5 @@
     "version": "dev-main",
     "require": {
         "drupal/core": ">=10.3"
-    },
-    "autoload": {
-        "psr-4": {
-            "Drupal\\drupal_cms_installer\\": "src"
-        }
     }
 }
diff --git a/drupal_cms_installer/drupal_cms_installer.profile b/drupal_cms_installer/drupal_cms_installer.profile
index a8411a151..cd1a4f7c9 100644
--- a/drupal_cms_installer/drupal_cms_installer.profile
+++ b/drupal_cms_installer/drupal_cms_installer.profile
@@ -16,6 +16,11 @@ use Drupal\drupal_cms_installer\Form\SiteNameForm;
  * Implements hook_install_tasks().
  */
 function drupal_cms_installer_install_tasks(): array {
+  // Ensure our forms are loadable in all situations, even if the installer is
+  // not a Composer-managed package.
+  \Drupal::service('class_loader')
+    ->addPsr4('Drupal\\drupal_cms_installer\\', __DIR__ . '/src');
+
   return [
     'drupal_cms_installer_prepare_trial' => [
       'run' => getenv('DRUPAL_CMS_TRIAL') ? INSTALL_TASK_RUN_IF_REACHED : INSTALL_TASK_SKIP,
diff --git a/drupal_cms_locations/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_locations/tests/src/Kernel/ComponentValidationTest.php
index c4253f87b..9633eecd9 100644
--- a/drupal_cms_locations/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_locations/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_locations\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_maintenance/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_maintenance/tests/src/Kernel/ComponentValidationTest.php
index 7cb944f7a..fb1915fd2 100644
--- a/drupal_cms_maintenance/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_maintenance/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_maintenance\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_media_tools/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_media_tools/tests/src/Kernel/ComponentValidationTest.php
index 16a627628..aab125c2c 100644
--- a/drupal_cms_media_tools/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_media_tools/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_media_tools\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_multilingual/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_multilingual/tests/src/Kernel/ComponentValidationTest.php
index 3258b6460..48c132339 100644
--- a/drupal_cms_multilingual/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_multilingual/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_multilingual\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_page_content_type/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_page_content_type/tests/src/Kernel/ComponentValidationTest.php
index b40e5e273..46596b469 100644
--- a/drupal_cms_page_content_type/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_page_content_type/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_page_content_type\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_seo_advanced/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_seo_advanced/tests/src/Kernel/ComponentValidationTest.php
index 7c484878c..b545b499d 100644
--- a/drupal_cms_seo_advanced/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_seo_advanced/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_seo_advanced\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_seo_basic/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_seo_basic/tests/src/Kernel/ComponentValidationTest.php
index 4bc68202e..e17665010 100644
--- a/drupal_cms_seo_basic/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_seo_basic/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_seo_basic\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
diff --git a/drupal_cms_workflows/tests/src/Kernel/ComponentValidationTest.php b/drupal_cms_workflows/tests/src/Kernel/ComponentValidationTest.php
index 762df30bc..ad0a4117f 100644
--- a/drupal_cms_workflows/tests/src/Kernel/ComponentValidationTest.php
+++ b/drupal_cms_workflows/tests/src/Kernel/ComponentValidationTest.php
@@ -4,7 +4,6 @@ declare(strict_types=1);
 
 namespace Drupal\Tests\drupal_cms_workflows\Kernel;
 
-use Composer\InstalledVersions;
 use Drupal\Core\Extension\ThemeInstallerInterface;
 use Drupal\Core\Recipe\Recipe;
 use Drupal\Core\Recipe\RecipeRunner;
@@ -47,7 +46,7 @@ class ComponentValidationTest extends KernelTestBase {
   }
 
   public function test(): void {
-    $dir = InstalledVersions::getInstallPath('drupal/' . explode('\\', __NAMESPACE__)[2]);
+    $dir = realpath(__DIR__ . '/../../..');
 
     // If the recipe is not valid, an exception should be thrown here.
     $recipe = Recipe::createFromDirectory($dir);
-- 
GitLab