From 5db19a052fb460cc2a88cb7799146588d4c729ad Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Thu, 19 Sep 2019 08:44:22 +0100
Subject: [PATCH] Issue #3080482 by Mile23, voleger, alexpott, larowlan:
 Decouple FunctionalTestSetupTrait from the simpletest module

---
 core/lib/Drupal/Core/DrupalKernel.php                  | 3 +--
 core/lib/Drupal/Core/Extension/ExtensionDiscovery.php  | 2 +-
 core/lib/Drupal/Core/Extension/ModuleExtensionList.php | 3 ++-
 core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php | 4 ++--
 core/modules/simpletest/src/KernelTestBase.php         | 2 +-
 core/tests/Drupal/KernelTests/KernelTestBase.php       | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 25a0f4e96049..e8eb9cd18a3a 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -776,8 +776,7 @@ protected function moduleData($module) {
 
       // If a module is within a profile directory but specifies another
       // profile for testing, it needs to be found in the parent profile.
-      $settings = $this->getConfigStorage()->read('simpletest.settings');
-      $parent_profile = !empty($settings['parent_profile']) ? $settings['parent_profile'] : NULL;
+      $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.
diff --git a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
index 717afc3be5d4..856d2e009c96 100644
--- a/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
+++ b/core/lib/Drupal/Core/Extension/ExtensionDiscovery.php
@@ -233,7 +233,7 @@ public function setProfileDirectoriesFromSettings() {
     // 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');
+      $testing_profile = Settings::get('test_parent_profile');
       if ($testing_profile && $testing_profile != $profile) {
         $this->profileDirectories[] = drupal_get_path('profile', $testing_profile);
       }
diff --git a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php
index c8f492bd4fe9..e637c14fa0b9 100644
--- a/core/lib/Drupal/Core/Extension/ModuleExtensionList.php
+++ b/core/lib/Drupal/Core/Extension/ModuleExtensionList.php
@@ -4,6 +4,7 @@
 
 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;
 
@@ -111,7 +112,7 @@ protected function getProfileDirectories(ExtensionDiscovery $discovery) {
 
     // 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 = $this->configFactory->get('simpletest.settings')->get('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
diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
index 3f8a74326abb..c085d4ec6bc2 100644
--- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
+++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php
@@ -107,7 +107,7 @@ protected function prepareSettings() {
     ];
     // Add the parent profile's search path to the child site's search paths.
     // @see \Drupal\Core\Extension\ExtensionDiscovery::getProfileDirectories()
-    $settings['conf']['simpletest.settings']['parent_profile'] = (object) [
+    $settings['setting']['test_parent_profile'] = (object) [
       'value' => $this->originalProfile,
       'required' => TRUE,
     ];
@@ -137,7 +137,7 @@ protected function prepareSettings() {
       $yaml = new SymfonyYaml();
       $content = file_get_contents($directory . '/services.yml');
       $services = $yaml->parse($content);
-      $services['services']['simpletest.config_schema_checker'] = [
+      $services['services']['testing.config_schema_checker'] = [
         'class' => ConfigSchemaChecker::class,
         'arguments' => ['@config.typed', $this->getConfigSchemaExclusions()],
         'tags' => [['name' => 'event_subscriber']],
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index 03d4784ad606..caab5335b590 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -351,7 +351,7 @@ public function containerBuild(ContainerBuilder $container) {
 
     if ($this->strictConfigSchema) {
       $container
-        ->register('simpletest.config_schema_checker', ConfigSchemaChecker::class)
+        ->register('testing.config_schema_checker', ConfigSchemaChecker::class)
         ->addArgument(new Reference('config.typed'))
         ->addArgument($this->getConfigSchemaExclusions())
         ->addTag('event_subscriber');
diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php
index e2d1c17f3bf7..fd26d08a142e 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBase.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBase.php
@@ -532,7 +532,7 @@ public function register(ContainerBuilder $container) {
 
     if ($this->strictConfigSchema) {
       $container
-        ->register('simpletest.config_schema_checker', ConfigSchemaChecker::class)
+        ->register('testing.config_schema_checker', ConfigSchemaChecker::class)
         ->addArgument(new Reference('config.typed'))
         ->addArgument($this->getConfigSchemaExclusions())
         ->addTag('event_subscriber');
-- 
GitLab