diff options
author | David Rothstein <drothstein@gmail.com> | 2012-06-28 00:49:18 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2012-06-28 00:49:18 -0400 |
commit | 46cf23289a03b1c6379c75ec9d3e4d27d76a6ea0 (patch) | |
tree | 8578309d283b0ca9f98f669cb0b514ae562f03b2 /modules/simpletest | |
parent | e1f366679ca13d2faf6d0d930d4c9fca92db1a30 (diff) | |
download | brdo-46cf23289a03b1c6379c75ec9d3e4d27d76a6ea0.tar.gz brdo-46cf23289a03b1c6379c75ec9d3e4d27d76a6ea0.tar.bz2 |
Issue #761608 by JohnAlbin, effulgentsia: Fixed Missing theme settings values because list_themes() has inconsistent theme object data.
Diffstat (limited to 'modules/simpletest')
5 files changed, 49 insertions, 0 deletions
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index ba6440028..27a8e47b9 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -124,6 +124,37 @@ class ThemeTestCase extends DrupalWebTestCase { module_enable(array('theme_test'), FALSE); $this->assertIdentical(theme('theme_test_foo', array('foo' => 'c')), 'c', 'The theme registry contains theme_test_foo again after re-enabling the module.'); } + + /** + * Test the list_themes() function. + */ + function testListThemes() { + $themes = list_themes(); + // Check if drupal_theme_access() retrieves enabled themes properly from list_themes(). + $this->assertTrue(drupal_theme_access('test_theme'), t('Enabled theme detected')); + // Check if list_themes() returns disabled themes. + $this->assertTrue(array_key_exists('test_basetheme', $themes), t('Disabled theme detected')); + // Check for base theme and subtheme lists. + $base_theme_list = array('test_basetheme' => 'Theme test base theme'); + $sub_theme_list = array('test_subtheme' => 'Theme test subtheme'); + $this->assertIdentical($themes['test_basetheme']->sub_themes, $sub_theme_list, t('Base theme\'s object includes list of subthemes.')); + $this->assertIdentical($themes['test_subtheme']->base_themes, $base_theme_list, t('Subtheme\'s object includes list of base themes.')); + // Check for theme engine in subtheme. + $this->assertIdentical($themes['test_subtheme']->engine, 'phptemplate', t('Subtheme\'s object includes the theme engine.')); + // Check for theme engine prefix. + $this->assertIdentical($themes['test_basetheme']->prefix, 'phptemplate', t('Base theme\'s object includes the theme engine prefix.')); + $this->assertIdentical($themes['test_subtheme']->prefix, 'phptemplate', t('Subtheme\'s object includes the theme engine prefix.')); + } + + /** + * Test the theme_get_setting() function. + */ + function testThemeGetSetting() { + $GLOBALS['theme_key'] = 'test_theme'; + $this->assertIdentical(theme_get_setting('theme_test_setting'), 'default value', t('theme_get_setting() uses the default theme automatically.')); + $this->assertNotEqual(theme_get_setting('subtheme_override', 'test_basetheme'), theme_get_setting('subtheme_override', 'test_subtheme'), t('Base theme\'s default settings values can be overridden by subtheme.')); + $this->assertIdentical(theme_get_setting('basetheme_only', 'test_subtheme'), 'base theme value', t('Base theme\'s default settings values are inherited by subtheme.')); + } } /** diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module index a9bd2ad24..61a12bb70 100644 --- a/modules/simpletest/tests/theme_test.module +++ b/modules/simpletest/tests/theme_test.module @@ -25,6 +25,8 @@ function theme_test_theme($existing, $type, $theme, $path) { */ function theme_test_system_theme_info() { $themes['test_theme'] = drupal_get_path('module', 'theme_test') . '/themes/test_theme/test_theme.info'; + $themes['test_basetheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_basetheme/test_basetheme.info'; + $themes['test_subtheme'] = drupal_get_path('module', 'theme_test') . '/themes/test_subtheme/test_subtheme.info'; return $themes; } diff --git a/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info b/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info new file mode 100644 index 000000000..c39e8a259 --- /dev/null +++ b/modules/simpletest/tests/themes/test_basetheme/test_basetheme.info @@ -0,0 +1,7 @@ +name = Theme test base theme +description = Test theme which acts as a base theme for other test subthemes. +core = 7.x +hidden = TRUE + +settings[basetheme_only] = base theme value +settings[subtheme_override] = base theme value diff --git a/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info b/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info new file mode 100644 index 000000000..7da71e003 --- /dev/null +++ b/modules/simpletest/tests/themes/test_subtheme/test_subtheme.info @@ -0,0 +1,7 @@ +name = Theme test subtheme +description = Test theme which uses test_basetheme as the base theme. +core = 7.x +base theme = test_basetheme +hidden = TRUE + +settings[subtheme_override] = subtheme value diff --git a/modules/simpletest/tests/themes/test_theme/test_theme.info b/modules/simpletest/tests/themes/test_theme/test_theme.info index dd5584b0b..4bbbe7a21 100644 --- a/modules/simpletest/tests/themes/test_theme/test_theme.info +++ b/modules/simpletest/tests/themes/test_theme/test_theme.info @@ -14,3 +14,5 @@ hidden = TRUE ; version from being loaded, and that errors aren't caused by the lack of this ; file within the theme folder. stylesheets[all][] = system.base.css + +settings[theme_test_setting] = default value |