protected function LinkGeneratorTest::assertNoXPathResults in Zircon Profile 8.0
Same name and namespace in other branches
- 8 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.
Parameters
string $query: The XPath query to execute.
string $html: The HTML snippet to check.
Return value
int The number of results that are found.
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 545 - Contains \Drupal\Tests\Core\Utility\LinkGeneratorTest.
Class
- LinkGeneratorTest
- @coversDefaultClass \Drupal\Core\Utility\LinkGenerator @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
protected function assertNoXPathResults($query, $html) {
$document = new \DOMDocument();
$document
->loadHTML($html);
$xpath = new \DOMXPath($document);
self::assertFalse((bool) $xpath
->query($query)->length);
}