diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index 99e9d4e..fa0883d 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -134,8 +134,8 @@ public function getDefault() { */ public function setDefault($theme) { $available_themes = $this->listInfo(); - if (!isset($available_themes[$key])) { - throw new \Exception("Theme $key does not exists."); + if (!isset($available_themes[$theme])) { + throw new \Exception("Theme $theme does not exists."); } $this->configFactory ->get('system.theme') diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php index 957007b..753ff5b 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php @@ -114,6 +114,7 @@ protected function setUp() { * @expectedExceptionMessage Theme name thisNameIsFarTooLong0000000000000000000000000000051 is over the maximum allowed length of 50 characters. */ public function testThemeEnableWithTooLongName() { + $this->themeHandler->systemList = array(); $this->themeHandler->enable(array('thisNameIsFarTooLong0000000000000000000000000000051')); } @@ -153,11 +154,6 @@ public function testEnableSingleTheme() { // Ensure that the themes_enabled hook is fired. $this->moduleHandler->expects($this->at(0)) ->method('invokeAll') - ->with('system_theme_info') - ->will($this->returnValue(array())); - - $this->moduleHandler->expects($this->at(1)) - ->method('invokeAll') ->with('themes_enabled', array($theme_list)); // Ensure the config installer will be called. @@ -216,8 +212,15 @@ public function testEnableAndListInfo() { $this->assertEquals('stark', $list_info['bartik']->base_theme); $this->assertEquals(0, $list_info['bartik']->status); + $this->themeHandler->reset(); + $mock = $this->getMockTheme('seven'); - $mock->info['status'] = 1; + $mock->status = 1; + $mock->info['stylesheets'] = array( + 'screen' => array( + 'style.css', + ), + ); $this->themeHandler->systemList['seven'] = $mock; $this->themeHandler->enable(array('seven'));