HtmlAttributesTest.php in Drupal 10
File
core/modules/system/tests/src/Functional/Theme/HtmlAttributesTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\Theme;
use Drupal\Tests\BrowserTestBase;
class HtmlAttributesTest extends BrowserTestBase {
protected static $modules = [
'theme_test',
];
protected $defaultTheme = 'stark';
public function testThemeHtmlAttributes() {
$this
->drupalGet('');
$this
->assertSession()
->responseContains('<html lang="en" dir="ltr" theme_test_html_attribute="theme test html attribute value">');
$attributes = $this
->xpath('/body[@theme_test_body_attribute="theme test body attribute value"]');
$this
->assertCount(1, $attributes, "Attribute set in the 'body' element via hook_preprocess_HOOK() found.");
}
}