From f9faeb6457840fb7e8fd93af9138dcae5326b2fe Mon Sep 17 00:00:00 2001 From: Moshe Weitzman Date: Wed, 19 Jan 2022 08:36:18 -0500 Subject: [PATCH] Remove dead code and re-enbale --partial test. (#5036) * Remove dead code and re-enbale --partial test. * Remove conditional --- src/Commands/core/SiteInstallCommands.php | 35 ---------------------- tests/functional/ConfigTest.php | 19 +++++------- tests/functional/PmEnDisUnListInfoTest.php | 6 ---- 3 files changed, 7 insertions(+), 53 deletions(-) diff --git a/src/Commands/core/SiteInstallCommands.php b/src/Commands/core/SiteInstallCommands.php index 9f69175dd9..fc55e45882 100644 --- a/src/Commands/core/SiteInstallCommands.php +++ b/src/Commands/core/SiteInstallCommands.php @@ -2,7 +2,6 @@ namespace Drush\Commands\core; -use Composer\Semver\Comparator; use Consolidation\AnnotatedCommand\CommandData; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Core\Database\Database; @@ -173,13 +172,6 @@ public function taskCallback($install_state): void protected function determineProfile($profile, $options, $class_loader) { - // --config-dir fails with Standard profile and any other one that carries content entities. - // Force to minimal install profile only for drupal < 8.6. - if ($options['config-dir'] && Comparator::lessThan(self::getVersion(), '8.6')) { - $this->logger()->info(dt("Using 'minimal' install profile since --config-dir option was provided.")); - $profile = 'minimal'; - } - // Try to get profile from existing config if not provided as an argument. // @todo Arguably Drupal core [$boot->getKernel()->getInstallProfile()] could do this - https://github.com/drupal/drupal/blob/8.6.x/core/lib/Drupal/Core/DrupalKernel.php#L1606 reads from DB storage but not file storage. if (empty($profile) && $options['existing-config']) { @@ -224,27 +216,6 @@ protected function determineProfile($profile, $options, $class_loader) return $profile; } - /** - * Post installation, run the configuration import. - * - * @hook post-command site-install - */ - public function post($result, CommandData $commandData): void - { - if ($config = $commandData->input()->getOption('config-dir') && Comparator::lessThan(self::getVersion(), '8.6')) { - // Set the destination site UUID to match the source UUID, to bypass a core fail-safe. - $source_storage = new FileStorage($config); - $options = array_merge(Drush::redispatchOptions(), ['yes' => true, 'strict' => 0]); - $selfRecord = $this->siteAliasManager()->getSelf(); - - $process = $this->processManager()->drush($selfRecord, 'config-set', ['system.site', 'uuid', $source_storage->read('system.site')['uuid']], $options); - $process->mustRun(); - - $process = $this->processManager()->drush($selfRecord, 'config-import', [], ['source' => $config] + $options); - $process->mustRun($process->showRealtime()); - } - } - /** * Check to see if there are any .yml files in the provided config directory. */ @@ -440,12 +411,6 @@ protected function getSitesSubdirFromUri($root, $uri) return false; } - public static function getVersion(): ?string - { - $drupal_root = Drush::bootstrapManager()->getRoot(); - return Drush::bootstrap()->getVersion($drupal_root); - } - /** * Fake the necessary HTTP headers that the Drupal installer still needs: * @see https://github.com/drupal/drupal/blob/d260101f1ea8a6970df88d2f1899248985c499fc/core/includes/install.core.inc#L287 diff --git a/tests/functional/ConfigTest.php b/tests/functional/ConfigTest.php index 36520171fe..f10c3d9f7d 100644 --- a/tests/functional/ConfigTest.php +++ b/tests/functional/ConfigTest.php @@ -100,20 +100,15 @@ public function testConfigExportImportStatusExistingConfig() // Test the --existing-config option for site:install. $this->drush('core:status', [], ['field' => 'drupal-version']); $drupal_version = $this->getOutputRaw(); - if (Comparator::greaterThanOrEqualTo($drupal_version, '8.6')) { - $contents = file_get_contents($system_site_yml); - $contents = preg_replace('/front: .*/', 'front: unish existing', $contents); - file_put_contents($system_site_yml, $contents); - $this->installDrupal('dev', true, ['existing-config' => true], false); - $this->drush('config-get', ['system.site', 'page'], ['format' => 'json']); - $page = $this->getOutputFromJSON('system.site:page'); - $this->assertStringContainsString('unish existing', $page['front'], 'Existing config was successfully imported during site:install.'); - } + $contents = file_get_contents($system_site_yml); + $contents = preg_replace('/front: .*/', 'front: unish existing', $contents); + file_put_contents($system_site_yml, $contents); + $this->installDrupal('dev', true, ['existing-config' => true], false); + $this->drush('config-get', ['system.site', 'page'], ['format' => 'json']); + $page = $this->getOutputFromJSON('system.site:page'); + $this->assertStringContainsString('unish existing', $page['front'], 'Existing config was successfully imported during site:install.'); // Similar, but this time via --partial option. - if ($this->isDrupalGreaterThanOrEqualTo('8.8.0')) { - $this->markTestSkipped('Partial config import not yet working on 8.8.0'); - } $contents = file_get_contents($system_site_yml); $contents = preg_replace('/front: .*/', 'front: unish partial', $contents); $partial_path = self::getSandbox() . '/partial'; diff --git a/tests/functional/PmEnDisUnListInfoTest.php b/tests/functional/PmEnDisUnListInfoTest.php index 3f772a28ca..1c3adddb51 100644 --- a/tests/functional/PmEnDisUnListInfoTest.php +++ b/tests/functional/PmEnDisUnListInfoTest.php @@ -47,13 +47,7 @@ public function testEnDisUnList() $drupal_version = $this->getOutputRaw(); // Test the testing install profile theme is installed. - // Since Drupal 8.8, stark is the default testing theme. - // https://www.drupal.org/node/3083055. - // TODO: Replace once Drupal 8.7 is no longer supported. $active_theme = 'stark'; - if (Comparator::lessThan($drupal_version, '8.8')) { - $active_theme = 'classy'; - } $this->assertStringContainsString($active_theme, $out, 'Themes are in the pm-list'); // Test cache was cleared after enabling a module.