function LinkGeneratorTest::assertNoXPathResults
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::assertNoXPathResults()
- 8.9.x core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::assertNoXPathResults()
- 11.x core/tests/Drupal/Tests/Core/Utility/LinkGeneratorTest.php \Drupal\Tests\Core\Utility\LinkGeneratorTest::assertNoXPathResults()
Checks that the given XPath query has no results in a given HTML snippet.
@internal
Parameters
string $query: The XPath query to execute.
string $html: The HTML snippet to check.
2 calls to LinkGeneratorTest::assertNoXPathResults()
- LinkGeneratorTest::testGenerateActive in core/
tests/ Drupal/ Tests/ Core/ Utility/ LinkGeneratorTest.php - Tests the active class on the link method.
- LinkGeneratorTest::testGenerateXss in core/
tests/ Drupal/ Tests/ Core/ Utility/ LinkGeneratorTest.php - Tests the link method with a script tab.
File
-
core/
tests/ Drupal/ Tests/ Core/ Utility/ LinkGeneratorTest.php, line 698
Class
- LinkGeneratorTest
- @coversDefaultClass \Drupal\Core\Utility\LinkGenerator @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
protected function assertNoXPathResults(string $query, string $html) : void {
$document = Html::load($html);
$xpath = new \DOMXPath($document);
self::assertFalse((bool) $xpath->query($query)->length);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.