function ThemeTestCase::testFrontPageThemeSuggestion in Drupal 7
Ensure page-front template suggestion is added when on front page.
File
- modules/
simpletest/ tests/ theme.test, line 73 - Tests for the theme API.
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.');
}