.../Drupal/Core/Test/FunctionalTestSetupTrait.php | 28 ++++++---------------- core/modules/simpletest/src/WebTestBase.php | 4 +++- .../TestSite/Commands/TestSiteInstallCommand.php | 4 +++- core/tests/Drupal/Tests/BrowserTestBase.php | 4 +++- .../Tests/Listeners/DeprecationListenerTrait.php | 2 +- 5 files changed, 17 insertions(+), 25 deletions(-) diff --git a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php index 0c02f9a2a6..fdf785e9d0 100644 --- a/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php +++ b/core/lib/Drupal/Core/Test/FunctionalTestSetupTrait.php @@ -362,29 +362,15 @@ protected function initConfig(ContainerInterface $container) { ->set('timezone.default', 'Australia/Sydney') ->save(); - if (empty($this->theme)) { - @trigger_error('Drupal\Tests\BrowserTestBase::$theme is required in drupal:9.0.0. See https://www.drupal.org/node/2352949', E_USER_DEPRECATED); - if ($this->profile === 'demo_umami') { - $this->theme = 'umami'; - } - elseif ($this->profile === 'standard') { - $this->theme = 'bartik'; - } - elseif ($this->profile === 'minimal') { - $this->theme = 'stark'; - } - elseif ($this->profile === 'testing') { - $this->theme = 'classy'; - $config->getEditable('system.theme')->clear('admin')->save(); - } - else { + if ($this->profile === 'testing' && empty($this->theme)) { + @trigger_error('Drupal\Tests\BrowserTestBase::$theme is required in drupal:9.0.0 when using the default "testing" install profile. See https://www.drupal.org/node/2352949, which includes recommendations on which theme to use', E_USER_DEPRECATED); + $this->theme = 'classy'; + $config->getEditable('system.theme') // @see core/modules/system/config/install/system.theme.yml - $this->theme = 'stark'; - } + ->clear('admin') + ->set('default', $this->theme) + ->save(); } - $config->getEditable('system.theme') - ->set('default', $this->theme) - ->save(); } /** diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 3ca58688e1..1b37ed434c 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -392,7 +392,9 @@ protected function setUp() { // Initialize and override certain configurations. $this->initConfig($container); - $this->installThemeFromClassProperty($container); + if ($this->profile === 'testing') { + $this->installThemeFromClassProperty($container); + } // Collect modules to install. $this->installModulesFromClassProperty($container); diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php index b4cd21e328..a6a84d27ef 100644 --- a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php +++ b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php @@ -198,7 +198,9 @@ protected function installDrupal() { $this->initSettings(); $container = $this->initKernel(\Drupal::request()); $this->initConfig($container); - $this->installThemeFromClassProperty($container); + if ($this->profile === 'testing') { + $this->installThemeFromClassProperty($container); + } $this->installModulesFromClassProperty($container); $this->rebuildAll(); } diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 617e326fbf..62e8026389 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -564,7 +564,9 @@ public function installDrupal() { $this->initSettings(); $container = $this->initKernel(\Drupal::request()); $this->initConfig($container); - $this->installThemeFromClassProperty($container); + if ($this->profile === 'testing') { + $this->installThemeFromClassProperty($container); + } $this->installModulesFromClassProperty($container); $this->rebuildAll(); } diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php index da5256c82f..a4c60fbd00 100644 --- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php @@ -141,7 +141,7 @@ public static function getSkippedDeprecations() { // symfony/browser-kit to 4.3+. 'The "Symfony\Component\BrowserKit\Response::getStatus()" method is deprecated since Symfony 4.3, use getStatusCode() instead.', // @todo Remove in … - 'Drupal\Tests\BrowserTestBase::$theme is required in drupal:9.0.0. See https://www.drupal.org/node/2352949', + 'Drupal\Tests\BrowserTestBase::$theme is required in drupal:9.0.0 when using the default "testing" install profile. See https://www.drupal.org/node/2352949, which includes recommendations on which theme to use', ]; }