diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-03-21 04:05:24 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-03-21 04:05:24 +0000 |
commit | 426f82ac6dc41caa09d98168a40c96b677223831 (patch) | |
tree | 4757b41b8ab36091bd3df6602cf0150316fe9bbe /modules/simpletest | |
parent | e6bdfc8a2e83ed0c289bab4b589e20c06fad26e8 (diff) | |
download | brdo-426f82ac6dc41caa09d98168a40c96b677223831.tar.gz brdo-426f82ac6dc41caa09d98168a40c96b677223831.tar.bz2 |
#241570 by effulgentsia and merlinofchaos: Fixed Theme preprocess functions do not get retained when using patterns.
Diffstat (limited to 'modules/simpletest')
-rw-r--r-- | modules/simpletest/tests/theme.test | 17 | ||||
-rw-r--r-- | modules/simpletest/tests/theme_test.info | 8 | ||||
-rw-r--r-- | modules/simpletest/tests/theme_test.module | 40 |
3 files changed, 63 insertions, 2 deletions
diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index d3ba6f9bb..631d69d5b 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -9,15 +9,20 @@ /** * Unit tests for the Theme API. */ -class TemplateUnitTest extends DrupalWebTestCase { +class ThemeUnitTest extends DrupalWebTestCase { public static function getInfo() { return array( 'name' => 'Theme API', - 'description' => 'Test low-level theme template functions.', + 'description' => 'Test low-level theme functions.', 'group' => 'Theme', ); } + function setUp() { + parent::setUp('theme_test'); + theme_enable(array('test_theme')); + } + /** * Test function theme_get_suggestions() for SA-CORE-2009-003. */ @@ -39,6 +44,14 @@ class TemplateUnitTest extends DrupalWebTestCase { $suggestions = theme_get_suggestions($args, 'page'); $this->assertEqual($suggestions, array('page__node', 'page__node__%', 'page__node__1'), t('Removed invalid \\0 from suggestions')); } + + /** + * Preprocess functions for the base hook should run even for suggestion implementations. + */ + function testPreprocessForSuggestions() { + $this->drupalGet('theme-test/suggestion'); + $this->assertText('test_theme_breadcrumb__suggestion: 1', t('Theme hook suggestion ran with data available from a preprocess function for the base hook.')); + } /** * Ensure page-front template suggestion is added when on front page. diff --git a/modules/simpletest/tests/theme_test.info b/modules/simpletest/tests/theme_test.info new file mode 100644 index 000000000..2a35cad76 --- /dev/null +++ b/modules/simpletest/tests/theme_test.info @@ -0,0 +1,8 @@ +; $Id$ +name = "Theme test" +description = "Support module for theme system testing." +package = Testing +version = VERSION +core = 7.x +files[] = theme_test.module +hidden = TRUE diff --git a/modules/simpletest/tests/theme_test.module b/modules/simpletest/tests/theme_test.module new file mode 100644 index 000000000..52359778f --- /dev/null +++ b/modules/simpletest/tests/theme_test.module @@ -0,0 +1,40 @@ +<?php +// $Id$ + +/** + * Implements hook_menu(). + */ +function theme_test_menu() { + $items['theme-test/suggestion'] = array( + 'title' => 'Suggestion', + 'page callback' => '_theme_test_suggestion', + 'access arguments' => array('access content'), + 'theme callback' => '_theme_custom_theme', + 'type' => MENU_CALLBACK, + ); + + return $items; +} + +/** + * Custom theme callback. + */ +function _theme_custom_theme() { + return 'test_theme'; +} + +/** + * Page callback, calls a theme hook suggestion. + */ +function _theme_test_suggestion() { + return theme(array('breadcrumb__suggestion', 'breadcrumb'), array()); +} + +/** + * Implements hook_preprocess_breadcrumb(). + * + * Set a variable that can later be tested to see if this function ran. + */ +function theme_test_preprocess_breadcrumb(&$variables) { + $variables['theme_test_preprocess_breadcrumb'] = 1; +} |