function AttributeTest::assertID
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::assertID()
- 8.9.x core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::assertID()
- 10 core/tests/Drupal/Tests/Core/Template/AttributeTest.php \Drupal\Tests\Core\Template\AttributeTest::assertID()
Checks that the given CSS ID is present in the given HTML snippet.
@internal
Parameters
string $id: The CSS ID to check.
string $html: The HTML snippet to check.
1 call to AttributeTest::assertID()
- AttributeTest::testPrint in core/
tests/ Drupal/ Tests/ Core/ Template/ AttributeTest.php - Tests printing of an attribute.
File
-
core/
tests/ Drupal/ Tests/ Core/ Template/ AttributeTest.php, line 420
Class
- AttributeTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Template%21Attribute.php/class/Attribute/11.x" title="Collects, sanitizes, and renders HTML attributes." class="local">\Drupal\Core\Template\Attribute</a> @group Template
Namespace
Drupal\Tests\Core\TemplateCode
protected function assertID(string $id, string $html) : void {
$xpath = "//*[@id='{$id}']";
self::assertTrue((bool) $this->getXPathResultCount($xpath, $html));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.