diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index 85f67b4..ba64400 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -111,6 +111,19 @@ class ThemeTestCase extends DrupalWebTestCase { $this->drupalGet('theme-test/suggestion'); variable_set('preprocess_css', 0); } + + /** + * 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.'); + } } /** diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module index cce7b80..a9bd2ad 100644 --- a/modules/simpletest/tests/theme_test.module +++ b/modules/simpletest/tests/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; } @@ -120,3 +123,10 @@ function _theme_test_alter() { function _theme_test_suggestion() { return theme(array('theme_test__suggestion', 'theme_test'), array()); } + +/** + * Theme function for testing theme('theme_test_foo'). + */ +function theme_theme_test_foo($variables) { + return $variables['foo']; +}