You are here

function ThemeTest::testPreprocessForSuggestions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Theme/ThemeTest.php \Drupal\system\Tests\Theme\ThemeTest::testPreprocessForSuggestions()

Ensures preprocess functions run even for suggestion implementations.

The theme hook used by this test has its base preprocess function in a separate file, so this test also ensures that that file is correctly loaded when needed.

File

core/modules/system/src/Tests/Theme/ThemeTest.php, line 118
Contains \Drupal\system\Tests\Theme\ThemeTest.

Class

ThemeTest
Tests low-level theme functions.

Namespace

Drupal\system\Tests\Theme

Code

function testPreprocessForSuggestions() {

  // Test with both an unprimed and primed theme registry.
  drupal_theme_rebuild();
  for ($i = 0; $i < 2; $i++) {
    $this
      ->drupalGet('theme-test/suggestion');
    $this
      ->assertText('Theme hook implementor=test_theme_theme_test__suggestion(). Foo=template_preprocess_theme_test', 'Theme hook suggestion ran with data available from a preprocess function for the base hook.');
  }
}