You are here

function HtmlAttributesTest::testThemeHtmlAttributes in Zircon Profile 8

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

Tests that attributes in the 'html' and 'body' elements can be altered.

File

core/modules/system/src/Tests/Theme/HtmlAttributesTest.php, line 29
Contains \Drupal\system\Tests\Theme\HtmlAttributesTest.

Class

HtmlAttributesTest
Tests attributes inserted in the 'html' and 'body' elements on the page.

Namespace

Drupal\system\Tests\Theme

Code

function testThemeHtmlAttributes() {
  $this
    ->drupalGet('');
  $attributes = $this
    ->xpath('/html[@theme_test_html_attribute="theme test html attribute value"]');
  $this
    ->assertTrue(count($attributes) == 1, "Attribute set in the 'html' element via hook_preprocess_HOOK() found.");
  $attributes = $this
    ->xpath('/html/body[@theme_test_body_attribute="theme test body attribute value"]');
  $this
    ->assertTrue(count($attributes) == 1, "Attribute set in the 'body' element via hook_preprocess_HOOK() found.");
}