diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-29 05:22:06 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-29 05:22:06 +0000 |
commit | ea75851ef5814a1b118169c56d5005917521eb6c (patch) | |
tree | a40ccac321364062a29757e551a58d393b752b71 /modules/simpletest/tests/theme_test.module | |
parent | 10eec627bab98eb1a04c333f6cc9594e81a6b49a (diff) | |
download | brdo-ea75851ef5814a1b118169c56d5005917521eb6c.tar.gz brdo-ea75851ef5814a1b118169c56d5005917521eb6c.tar.bz2 |
#764094 by David_Rothstein: Add tests to check that the theme system works in hook_init() (i.e., as early as possible).
Diffstat (limited to 'modules/simpletest/tests/theme_test.module')
-rw-r--r-- | modules/simpletest/tests/theme_test.module | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module index 52359778f..d11705bea 100644 --- a/modules/simpletest/tests/theme_test.module +++ b/modules/simpletest/tests/theme_test.module @@ -12,11 +12,37 @@ function theme_test_menu() { 'theme callback' => '_theme_custom_theme', 'type' => MENU_CALLBACK, ); - + $items['theme-test/hook-init'] = array( + 'page callback' => 'theme_test_hook_init_page_callback', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); return $items; } /** + * Implements hook_init(). + */ +function theme_test_init() { + // First, force the theme registry to be rebuilt on this page request. This + // allows us to test a full initialization of the theme system in the code + // below. + drupal_theme_rebuild(); + // Next, initialize the theme system by storing themed text in a global + // variable. We will use this later in theme_test_hook_init_page_callback() + // to test that even when the theme system is initialized this early, it is + // still capable of returning output and theming the page as a whole. + $GLOBALS['theme_test_output'] = theme('more_link', array('url' => url('user'), 'title' => 'Themed output generated in hook_init()')); +} + +/** + * Menu callback for testing themed output generated in hook_init(). + */ +function theme_test_hook_init_page_callback() { + return $GLOBALS['theme_test_output']; +} + +/** * Custom theme callback. */ function _theme_custom_theme() { |