Issue #3081501 by Mile23, Wim Leers, alexpott: Remove TestSetupTrait::$originalProfile and test infrastructure which uses it

merge-requests/55/head
Alex Pott 2019-09-30 09:44:12 +01:00
parent c7a1b0204b
commit 4e3cc125c1
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
6 changed files with 1 additions and 47 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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,

View File

@ -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.
*

View File

@ -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