diff --git a/core/modules/system/tests/modules/theme_test/theme_test.module b/core/modules/system/tests/modules/theme_test/theme_test.module index f2cd4a0..265cf80 100644 --- a/core/modules/system/tests/modules/theme_test/theme_test.module +++ b/core/modules/system/tests/modules/theme_test/theme_test.module @@ -14,6 +14,9 @@ function theme_test_theme($existing, $type, $theme, $path) { $items['theme_test_template_test_2'] = array( 'template' => 'theme_test.template_test', ); + $items['theme_test_foo'] = array( + 'variables' => array('foo' => NULL), + ); return $items; } @@ -142,3 +145,10 @@ function theme_test_preprocess_html(&$variables) { $variables['html_attributes_array']['theme_test_html_attribute'] = 'theme test html attribute value'; $variables['body_attributes_array']['theme_test_body_attribute'] = 'theme test body attribute value'; } + +/** + * Theme function for testing theme('theme_test_foo'). + */ +function theme_theme_test_foo($variables) { + return $variables['foo']; +} diff --git a/core/modules/system/tests/theme.test b/core/modules/system/tests/theme.test index 978887c..423ee71 100644 --- a/core/modules/system/tests/theme.test +++ b/core/modules/system/tests/theme.test @@ -154,6 +154,19 @@ class ThemeUnitTest extends DrupalWebTestCase { $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.')); } + + /** + * Ensures the theme registry is rebuilt when modules are disabled/enabled. + */ + function testRegistryRebuild() { + $this->assertIdentical(theme('theme_test_foo', array('foo' => 'a')), 'a', 'The theme registry contains theme_test_foo.'); + + module_disable(array('theme_test'), FALSE); + $this->assertIdentical(theme('theme_test_foo', array('foo' => 'b')), '', 'The theme registry does not contain theme_test_foo, because the module is disabled.'); + + 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.'); + } } /**