--- /home/shaal/Downloads/1356276-587.patch 2019-10-21 16:54:02.155981158 -0400 +++ /home/shaal/Downloads/1356276-88x-594.patch 2019-10-21 16:57:06.565319334 -0400 @@ -1,5 +1,5 @@ diff --git a/core/core.services.yml b/core/core.services.yml -index 04f75f64bc..df8db4844b 100644 +index b093d4bfac..8b45dc853d 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -304,7 +304,7 @@ services: @@ -12,10 +12,10 @@ config.storage: class: Drupal\Core\Config\CachedStorage diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc -index 6910245723..0102cfc965 100644 +index 61019018e8..693e20f14d 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc -@@ -467,6 +467,12 @@ function install_begin_request($class_loader, &$install_state) { +@@ -468,6 +468,12 @@ function install_begin_request($class_loader, &$install_state) { if (isset($install_state['profile_info']['distribution']['install']['theme'])) { $install_state['theme'] = $install_state['profile_info']['distribution']['install']['theme']; } @@ -28,7 +28,7 @@ } // Before having installed the system module and being able to do a module -@@ -1276,7 +1282,9 @@ function install_select_profile(&$install_state) { +@@ -1263,7 +1269,9 @@ function install_select_profile(&$install_state) { * - For interactive installations via request query parameters. * - For non-interactive installations via install_drupal() settings. * - One of the available profiles is a distribution. If multiple profiles are @@ -39,7 +39,7 @@ * - Only one visible profile is available. * * @param array $install_state -@@ -1301,12 +1309,9 @@ function _install_select_profile(&$install_state) { +@@ -1288,12 +1296,9 @@ function _install_select_profile(&$install_state) { return $profile; } } @@ -55,7 +55,7 @@ } // Get all visible (not hidden) profiles. $visible_profiles = array_filter($install_state['profiles'], function ($profile) { -@@ -1655,7 +1660,10 @@ function install_profile_themes(&$install_state) { +@@ -1642,7 +1647,10 @@ function install_profile_themes(&$install_state) { * An array of information about the current installation state. */ function install_install_profile(&$install_state) { @@ -68,10 +68,10 @@ // is determined by dependencies. If there are no dependencies between modules // then the order in which they are installed is dependent on random factors diff --git a/core/includes/install.inc b/core/includes/install.inc -index d07d7d66e5..5930dec7af 100644 +index 3f2f79b6fc..d1a0fd51a2 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc -@@ -569,7 +569,6 @@ function install_ensure_config_directory($type) { +@@ -572,7 +572,6 @@ function install_ensure_config_directory($type) { * The list of modules to install. */ function drupal_verify_profile($install_state) { @@ -79,7 +79,7 @@ $info = $install_state['profile_info']; // Get the list of available modules for the selected installation profile. -@@ -578,10 +577,11 @@ function drupal_verify_profile($install_state) { +@@ -581,10 +580,11 @@ function drupal_verify_profile($install_state) { foreach ($listing->scan('module') as $present_module) { $present_modules[] = $present_module->getName(); } @@ -95,7 +95,7 @@ // Verify that all of the profile's required modules are present. $missing_modules = array_diff($info['install'], $present_modules); -@@ -1082,6 +1082,9 @@ function drupal_check_module($module) { +@@ -1092,6 +1092,9 @@ function drupal_check_module($module) { * Drupal's default installer theme. * - finish_url: A destination to visit after the installation of the * distribution is finished @@ -105,7 +105,7 @@ * * Note that this function does an expensive file system scan to get info file * information for dependencies. If you only need information from the info -@@ -1108,20 +1111,9 @@ function install_profile_info($profile, $langcode = 'en') { +@@ -1119,20 +1122,9 @@ function install_profile_info($profile, $langcode = 'en') { static $cache = []; if (!isset($cache[$profile][$langcode])) { @@ -128,7 +128,7 @@ $dependency_name_function = function ($dependency) { return Dependency::createFromString($dependency)->getName(); -@@ -1142,6 +1134,9 @@ function install_profile_info($profile, $langcode = 'en') { +@@ -1153,6 +1145,9 @@ function install_profile_info($profile, $langcode = 'en') { // remove any duplicates. $info['install'] = array_unique(array_merge($info['install'], $required, $info['dependencies'], $locale)); @@ -139,7 +139,7 @@ if (is_dir($profile_path . '/config/sync')) { $info['config_install_path'] = $profile_path . '/config/sync'; diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php -index 66ebcedd5e..7cde636f20 100644 +index da188315eb..64e6eaa3b4 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -4,6 +4,7 @@ @@ -147,10 +147,10 @@ use Drupal\Component\Utility\Crypt; use Drupal\Core\Config\Entity\ConfigDependencyManager; +use Drupal\Core\Extension\ProfileExtensionList; + use Drupal\Core\Installer\InstallerKernel; use Symfony\Component\EventDispatcher\EventDispatcherInterface; - class ConfigInstaller implements ConfigInstallerInterface { -@@ -50,6 +51,13 @@ class ConfigInstaller implements ConfigInstallerInterface { +@@ -51,6 +52,13 @@ class ConfigInstaller implements ConfigInstallerInterface { */ protected $sourceStorage; @@ -164,7 +164,7 @@ /** * Is configuration being created as part of a configuration sync. * -@@ -79,14 +87,17 @@ class ConfigInstaller implements ConfigInstallerInterface { +@@ -80,14 +88,17 @@ class ConfigInstaller implements ConfigInstallerInterface { * The event dispatcher. * @param string $install_profile * The name of the currently active installation profile. @@ -183,7 +183,7 @@ } /** -@@ -483,7 +494,8 @@ public function checkConfigurationToInstall($type, $name) { +@@ -511,7 +522,8 @@ public function checkConfigurationToInstall($type, $name) { // Install profiles can not have config clashes. Configuration that // has the same name as a module's configuration will be used instead. @@ -322,10 +322,10 @@ if (isset($profile_list[$profile])) { // Prime the drupal_get_filename() static cache with the profile info diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php -index 7f2f35c32b..d722723bb6 100644 +index f521bb1655..35fa8c2112 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php -@@ -118,12 +118,18 @@ protected function validateModules(ConfigImporter $config_importer) { +@@ -119,12 +119,18 @@ protected function validateModules(ConfigImporter $config_importer) { $config_importer->logError($this->t('Unable to install the %module module since it does not exist.', ['%module' => $module])); } @@ -345,7 +345,7 @@ $missing_dependencies[] = $module_data[$required_module]->info['name']; } } -@@ -143,18 +149,44 @@ protected function validateModules(ConfigImporter $config_importer) { +@@ -144,18 +150,44 @@ protected function validateModules(ConfigImporter $config_importer) { $uninstalls = $config_importer->getExtensionChangelist('module', 'uninstall'); foreach ($uninstalls as $module) { foreach (array_keys($module_data[$module]->required_by) as $dependent_module) { @@ -399,7 +399,7 @@ } diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php -index 717afc3be5..269ebea5d3 100644 +index f9c7421dd7..269ebea5d3 100644 --- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php +++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php @@ -91,6 +91,15 @@ class ExtensionDiscovery { @@ -444,11 +444,25 @@ } /** -@@ -241,7 +262,19 @@ public function setProfileDirectoriesFromSettings() { - // In case both profile directories contain the same extension, the actual - // profile always has precedence. - if ($profile) { +@@ -228,8 +249,32 @@ public function scan($type, $include_tests = NULL) { + */ + public function setProfileDirectoriesFromSettings() { + $this->profileDirectories = []; +- if ($profile = \Drupal::installProfile()) { - $this->profileDirectories[] = drupal_get_path('profile', $profile); ++ $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 = \Drupal::config('simpletest.settings')->get('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 ($this->profileList) { + $profiles = $this->profileList->getAncestors($profile); + } @@ -466,7 +480,7 @@ return $this; } diff --git a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php -index c8f492bd4f..1990c93716 100644 +index 60b08cc8b5..fa429b6212 100644 --- a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php +++ b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php @@ -41,7 +41,7 @@ class ModuleExtensionList extends ExtensionList { @@ -503,9 +517,9 @@ - $profiles = array_intersect_key($all_profiles, $this->configFactory->get('core.extension')->get('module') ?: [$active_profile->getName() => 0]); + $profiles = $this->profileList->getAncestors($this->installProfile); - // If a module is within a profile directory but specifies another - // profile for testing, it needs to be found in the parent profile. -@@ -145,13 +144,9 @@ protected function getActiveProfile() { + $profile_directories = array_map(function (Extension $profile) { + return $profile->getPath(); +@@ -135,13 +134,9 @@ protected function getActiveProfile() { */ protected function doScanExtensions() { $extensions = parent::doScanExtensions(); @@ -523,10 +537,10 @@ return $extensions; } diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php -index 5246946e09..9fdcf267cb 100644 +index 62dbb6c9b0..8cafcb8de4 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php -@@ -361,7 +361,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { +@@ -377,7 +377,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { return FALSE; }