From dce608f5a4a33fb679c266c926efdaf4a084ba86 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Tue, 23 Feb 2010 18:32:00 +0000 Subject: #674784 by JohnAlbin, naxoc, et al: Fixed theme_get_suggestions() fails to return 'page__front()' suggestion on front page. --- modules/simpletest/tests/theme.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'modules/simpletest/tests') diff --git a/modules/simpletest/tests/theme.test b/modules/simpletest/tests/theme.test index 0be8cb05a..c46dc9d93 100644 --- a/modules/simpletest/tests/theme.test +++ b/modules/simpletest/tests/theme.test @@ -39,6 +39,20 @@ 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')); } + + /** + * Ensure page-front template suggestion is added when on front page. + */ + function testFrontPageThemeSuggestion() { + $q = $_GET['q']; + // Set $_GET['q'] to node because theme_get_suggestions() will query it to + // see if we are on the front page. + $_GET['q'] = variable_get('site_frontpage', 'node'); + $suggestions = theme_get_suggestions(explode('/', $_GET['q']), 'page'); + // Set it back to not annoy the batch runner. + $_GET['q'] = $q; + $this->assertTrue(in_array('page__front', $suggestions), t('Front page template was suggested.')); + } } /** -- cgit v1.2.3