function ThemeTestCase::testFrontPageThemeSuggestion
Ensure page-front template suggestion is added when on front page.
File
-
modules/
simpletest/ tests/ theme.test, line 73
Class
- ThemeTestCase
- Unit tests for the Theme API.
Code
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), 'Front page template was suggested.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.