From 4e3cc125c1c1a4b343c8642610e750d19996f264 Mon Sep 17 00:00:00 2001 From: Alex Pott Date: Mon, 30 Sep 2019 09:44:12 +0100 Subject: [PATCH] Issue #3081501 by Mile23, Wim Leers, alexpott: Remove TestSetupTrait::$originalProfile and test infrastructure which uses it --- core/lib/Drupal/Core/DrupalKernel.php | 9 --------- .../Drupal/Core/Extension/ExtensionDiscovery.php | 14 +------------- .../Drupal/Core/Extension/ModuleExtensionList.php | 11 ----------- .../Drupal/Core/Test/FunctionalTestSetupTrait.php | 6 ------ core/lib/Drupal/Core/Test/TestSetupTrait.php | 7 ------- core/modules/simpletest/src/TestBase.php | 1 - 6 files changed, 1 insertion(+), 47 deletions(-) diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index e8eb9cd18a3..d80e87270be 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -774,15 +774,6 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { $all_profiles = $listing->scan('profile'); $profiles = array_intersect_key($all_profiles, $this->moduleList); - // If a module is within a profile directory but specifies another - // profile for testing, it needs to be found in the parent profile. - $parent_profile = Settings::get('test_parent_profile'); - if ($parent_profile && !isset($profiles[$parent_profile])) { - // In case both profile directories contain the same extension, the - // actual profile always has precedence. - $profiles = [$parent_profile => $all_profiles[$parent_profile]] + $profiles; - } - $profile_directories = array_map(function ($profile) { return $profile->getPath(); }, $profiles); diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php index 856d2e009c9..f9c7421dd7a 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php +++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php @@ -228,19 +228,7 @@ class ExtensionDiscovery { */ public function setProfileDirectoriesFromSettings() { $this->profileDirectories = []; - $profile = \Drupal::installProfile(); - // For SimpleTest to be able to test modules packaged together with a - // distribution we need to include the profile of the parent site (in - // which test runs are triggered). - if (drupal_valid_test_ua() && !drupal_installation_attempted()) { - $testing_profile = Settings::get('test_parent_profile'); - if ($testing_profile && $testing_profile != $profile) { - $this->profileDirectories[] = drupal_get_path('profile', $testing_profile); - } - } - // In case both profile directories contain the same extension, the actual - // profile always has precedence. - if ($profile) { + if ($profile = \Drupal::installProfile()) { $this->profileDirectories[] = drupal_get_path('profile', $profile); } return $this; diff --git a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php index e637c14fa0b..60b08cc8b54 100644 --- a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php @@ -4,7 +4,6 @@ namespace Drupal\Core\Extension; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Config\ConfigFactoryInterface; -use Drupal\Core\Site\Settings; use Drupal\Core\State\StateInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; @@ -110,16 +109,6 @@ class ModuleExtensionList extends ExtensionList { $active_profile = $all_profiles[$this->installProfile]; $profiles = array_intersect_key($all_profiles, $this->configFactory->get('core.extension')->get('module') ?: [$active_profile->getName() => 0]); - // If a module is within a profile directory but specifies another - // profile for testing, it needs to be found in the parent profile. - $parent_profile = Settings::get('test_parent_profile'); - - if ($parent_profile && !isset($profiles[$parent_profile])) { - // In case both profile directories contain the same extension, the - // actual profile always has precedence. - $profiles = [$parent_profile => $all_profiles[$parent_profile]] + $profiles; - } - $profile_directories = array_map(function (Extension $profile) { return $profile->getPath(); }, $profiles); diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php index 3154b7f0d0e..b56f6ac228d 100644 --- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php +++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php @@ -108,12 +108,6 @@ trait FunctionalTestSetupTrait { 'value' => $this->originalSite, 'required' => TRUE, ]; - // Add the parent profile's search path to the child site's search paths. - // @see \Drupal\Core\Extension\ExtensionDiscovery::getProfileDirectories() - $settings['setting']['test_parent_profile'] = (object) [ - 'value' => $this->originalProfile, - 'required' => TRUE, - ]; $settings['settings']['apcu_ensure_unique_prefix'] = (object) [ 'value' => $this->apcuEnsureUniquePrefix, 'required' => TRUE, diff --git a/core/lib/Drupal/Core/Test/TestSetupTrait.php b/core/lib/Drupal/Core/Test/TestSetupTrait.php index 0625691022c..1cac0bea583 100644 --- a/core/lib/Drupal/Core/Test/TestSetupTrait.php +++ b/core/lib/Drupal/Core/Test/TestSetupTrait.php @@ -66,13 +66,6 @@ trait TestSetupTrait { */ protected $privateFilesDirectory; - /** - * The original installation profile. - * - * @var string - */ - protected $originalProfile; - /** * Set to TRUE to strict check all configuration saved. * diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index c3d5495fd00..1699370bd06 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1109,7 +1109,6 @@ abstract class TestBase { // Use the original files directory to avoid nesting it within an existing // simpletest directory if a test is executed within a test. $this->originalFileDirectory = Settings::get('file_public_path', $site_path . '/files'); - $this->originalProfile = $this->originalContainer->getParameter('install_profile'); $this->originalUser = isset($user) ? clone $user : NULL; // Prevent that session data is leaked into the UI test runner by closing