1 theme.test ThemeUnitTest::testFrontPageThemeSuggestion()

Ensure page-front template suggestion is added when on home page.

File

core/modules/simpletest/tests/theme.test, line 64
Tests for the theme API.

Class

ThemeUnitTest
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 home page.
  config_set('system.core', 'site_frontpage', 'node');
  $_GET['q'] = '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), 'Home page template was suggested.');
}