public function ThemeTest::testSuggestionPreprocessForDefaults in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Theme/ThemeTest.php \Drupal\system\Tests\Theme\ThemeTest::testSuggestionPreprocessForDefaults()
Ensures suggestion preprocess functions run for default 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 305 - Contains \Drupal\system\Tests\Theme\ThemeTest.
Class
- ThemeTest
- Tests low-level theme functions.
Namespace
Drupal\system\Tests\ThemeCode
public function testSuggestionPreprocessForDefaults() {
\Drupal::service('theme_handler')
->setDefault('test_theme');
// Test with both an unprimed and primed theme registry.
drupal_theme_rebuild();
for ($i = 0; $i < 2; $i++) {
$this
->drupalGet('theme-test/preprocess-suggestions');
$items = $this
->cssSelect('.suggestion');
$expected_values = [
'Suggestion',
'Kitten',
'Monkey',
'Kitten',
'Flamingo',
];
foreach ($expected_values as $key => $value) {
$this
->assertEqual((string) $value, $items[$key]);
}
}
}