function ThemeTest::testPreprocessHtml
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testPreprocessHtml()
- 10 core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testPreprocessHtml()
- 11.x core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testPreprocessHtml()
Tests that the page variable is not prematurely flattened.
Some modules check the page array in template_preprocess_html(), so we ensure that it has not been rendered prematurely.
File
-
core/
modules/ system/ tests/ src/ Functional/ Theme/ ThemeTest.php, line 150
Class
- ThemeTest
- Tests low-level theme functions.
Namespace
Drupal\Tests\system\Functional\ThemeCode
public function testPreprocessHtml() {
$this->drupalGet('');
$attributes = $this->xpath('/body[@theme_test_page_variable="Page variable is an array."]');
$this->assertCount(1, $attributes, 'In template_preprocess_html(), the page variable is still an array (not rendered yet).');
$this->assertText('theme test page bottom markup', 'Modules are able to set the page bottom region.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.