annotate core/modules/system/src/Tests/Theme/HtmlAttributesTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\system\Tests\Theme;
Chris@0 4
Chris@0 5 use Drupal\simpletest\WebTestBase;
Chris@0 6
Chris@0 7 /**
Chris@0 8 * Tests attributes inserted in the 'html' and 'body' elements on the page.
Chris@0 9 *
Chris@0 10 * @group Theme
Chris@0 11 */
Chris@0 12 class HtmlAttributesTest extends WebTestBase {
Chris@0 13
Chris@0 14 /**
Chris@0 15 * Modules to enable.
Chris@0 16 *
Chris@0 17 * @var array
Chris@0 18 */
Chris@0 19 public static $modules = ['theme_test'];
Chris@0 20
Chris@0 21 /**
Chris@0 22 * Tests that attributes in the 'html' and 'body' elements can be altered.
Chris@0 23 */
Chris@0 24 public function testThemeHtmlAttributes() {
Chris@0 25 $this->drupalGet('');
Chris@0 26 $attributes = $this->xpath('/html[@theme_test_html_attribute="theme test html attribute value"]');
Chris@0 27 $this->assertTrue(count($attributes) == 1, "Attribute set in the 'html' element via hook_preprocess_HOOK() found.");
Chris@0 28 $attributes = $this->xpath('/html/body[@theme_test_body_attribute="theme test body attribute value"]');
Chris@0 29 $this->assertTrue(count($attributes) == 1, "Attribute set in the 'body' element via hook_preprocess_HOOK() found.");
Chris@0 30 }
Chris@0 31
Chris@0 32 }