diff --git a/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php b/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php index fb7c850..02ce576 100644 --- a/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php +++ b/core/lib/Drupal/Core/Theme/ThemeHandlerInterface.php @@ -69,9 +69,9 @@ public function disable(array $theme_list); * - sub_themes: An associative array of themes on the system that are * either direct sub-themes (that is, they declare this theme to be * their base theme), direct sub-themes of sub-themes, etc. The keys are - * the themes' machine names, and the values are the themes' human-readable - * names. This element is not set if there are no themes on the system that - * declare this theme as their base theme. + * the themes' machine names, and the values are the themes' + * human-readable names. This element is not set if there are no themes on + * the system that declare this theme as their base theme. */ public function listInfo(); @@ -100,8 +100,8 @@ public function rebuildThemeData(); * The name of the theme whose base we are looking for. * * @return array - * Returns an array of all of the theme's ancestors; the first element's value - * will be NULL if an error occurred. + * Returns an array of all of the theme's ancestors; the first element's + * value will be NULL if an error occurred. */ public function getBaseThemes(array $themes, $theme); diff --git a/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php b/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php index fa26bfd..f268e02 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Batch/PageTest.php @@ -50,7 +50,6 @@ function testBatchProgressPageTheme() { $this->drupalGet('admin/batch-test/test-theme'); // The stack should contain the name of the theme used on the progress // page. - debug(batch_test_stack()); $this->assertEqual(batch_test_stack(), array('seven'), 'A progressive batch correctly uses the theme of the page that started the batch.'); } } diff --git a/core/tests/Drupal/Tests/Core/Theme/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Theme/ThemeHandlerTest.php index 2c20eaf..58b1594 100644 --- a/core/tests/Drupal/Tests/Core/Theme/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Theme/ThemeHandlerTest.php @@ -275,11 +275,31 @@ public function testRebuildThemeData() { } /** - * Tests a theme without any base theme. + * Tests getting the base themes for a set a defines themes. * - * @covers \Drupal\Core\Theme\ThemeHandler::getBaseThemes() + * @param array $themes + * An array of available themes, keyed by the theme name. + * @param string $theme + * The theme name to find all its base themes. + * @param array $expected + * The expected base themes. + * + * @dataProvider providerTestGetBaseThemes + */ + public function testGetBaseThemes(array $themes, $theme, array $expected) { + $base_themes = $this->themeHandler->getBaseThemes($themes, $theme); + $this->assertEquals($expected, $base_themes); + } + + /** + * Provides test data for testGetBaseThemes + * + * @return array */ - public function testGetBaseThemesWithoutBaseTheme() { + public function providerTestGetBaseThemes() { + $data = array(); + + // Tests a theme without any base theme. $themes = array(); $themes['test_1'] = (object) array( 'name' => 'test_1', @@ -287,16 +307,9 @@ public function testGetBaseThemesWithoutBaseTheme() { 'name' => 'test_1', ), ); - $base_themes = $this->themeHandler->getBaseThemes($themes, 'test_1'); - $this->assertEquals(array(), $base_themes); - } + $data[] = array($themes, 'test_1', array()); - /** - * Tests a theme with a non existing base theme. - * - * @covers \Drupal\Core\Theme\ThemeHandler::getBaseThemes() - */ - public function testGetBaseThemesWithNonExistingBaseTheme() { + // Tests a theme with a non existing base theme. $themes = array(); $themes['test_1'] = (object) array( 'name' => 'test_1', @@ -305,16 +318,9 @@ public function testGetBaseThemesWithNonExistingBaseTheme() { 'base theme' => 'test_2', ), ); - $base_themes = $this->themeHandler->getBaseThemes($themes, 'test_1'); - $this->assertEquals(array('test_2' => NULL), $base_themes); - } + $data[] = array($themes, 'test_1', array('test_2' => NULL)); - /** - * Tests a theme with a single existing base theme. - * - * @covers \Drupal\Core\Theme\ThemeHandler::getBaseThemes() - */ - public function testGetBaseThemesWithOneBaseTheme() { + // Tests a theme with a single existing base theme. $themes = array(); $themes['test_1'] = (object) array( 'name' => 'test_1', @@ -329,16 +335,9 @@ public function testGetBaseThemesWithOneBaseTheme() { 'name' => 'test_2', ), ); - $base_themes = $this->themeHandler->getBaseThemes($themes, 'test_1'); - $this->assertEquals(array('test_2' => 'test_2'), $base_themes); - } + $data[] = array($themes, 'test_1', array('test_2' => 'test_2')); - /** - * Tests a theme with multiple base themes. - * - * @covers \Drupal\Core\Theme\ThemeHandler::getBaseThemes() - */ - public function testGetBaseThemesWithMultipleBaseThemes() { + // Tests a theme with multiple base themes. $themes = array(); $themes['test_1'] = (object) array( 'name' => 'test_1', @@ -360,8 +359,9 @@ public function testGetBaseThemesWithMultipleBaseThemes() { 'name' => 'test_3', ), ); - $base_themes = $this->themeHandler->getBaseThemes($themes, 'test_1'); - $this->assertEquals(array('test_2' => 'test_2', 'test_3' => 'test_3'), $base_themes); + $data[] = array($themes, 'test_1', array('test_2' => 'test_2', 'test_3' => 'test_3')); + + return $data; } }