function ThemeTest::testPreprocessHtml

Same name and namespace in other branches
  1. 11.x core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testPreprocessHtml()
  2. 10 core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testPreprocessHtml()
  3. 9 core/modules/system/tests/src/Functional/Theme/ThemeTest.php \Drupal\Tests\system\Functional\Theme\ThemeTest::testPreprocessHtml()
  4. 8.9.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 html template preprocess hooks, so we ensure that it has not been rendered prematurely.

File

core/modules/system/tests/src/Functional/Theme/ThemeTest.php, line 140

Class

ThemeTest
Tests low-level theme functions.

Namespace

Drupal\Tests\system\Functional\Theme

Code

public function testPreprocessHtml() : void {
  $this->drupalGet('');
  $this->assertSession()
    ->elementsCount('xpath', '/body[@theme_test_page_variable="Page variable is an array."]', 1);
  $this->assertSession()
    ->pageTextContains('theme test page bottom markup');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.