protected function AssertContentTrait::xpath in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/simpletest/src/AssertContentTrait.php \Drupal\simpletest\AssertContentTrait::xpath()
Performs an xpath search on the contents of the internal browser.
The search is relative to the root element (HTML tag normally) of the page.
Parameters
string $xpath: The xpath string to use in the search.
array $arguments: An array of arguments with keys in the form ':name' matching the placeholders in the query. The values may be either strings or numeric values.
Return value
array The return value of the xpath search. For details on the xpath string format and return values see the SimpleXML documentation, http://php.net/manual/function.simplexml-element-xpath.php.
328 calls to AssertContentTrait::xpath()
- AggregatorAdminTest::testOverviewPage in core/
modules/ aggregator/ src/ Tests/ AggregatorAdminTest.php - Tests the overview page.
- AggregatorRenderingTest::testBlockLinks in core/
modules/ aggregator/ src/ Tests/ AggregatorRenderingTest.php - Adds a feed block to the page and checks its links.
- AggregatorRenderingTest::testFeedPage in core/
modules/ aggregator/ src/ Tests/ AggregatorRenderingTest.php - Creates a feed and checks that feed's page.
- AjaxFormPageCacheTest::getFormBuildId in core/
modules/ system/ src/ Tests/ Ajax/ AjaxFormPageCacheTest.php - Return the build id of the current form.
- AnalyzeTest::testAnalyzeBasic in core/
modules/ views_ui/ src/ Tests/ AnalyzeTest.php - Tests that analyze works in general.
File
- core/
modules/ simpletest/ src/ AssertContentTrait.php, line 228 - Contains \Drupal\simpletest\AssertContentTrait.
Class
- AssertContentTrait
- Provides test methods to assert content.
Namespace
Drupal\simpletestCode
protected function xpath($xpath, array $arguments = array()) {
if ($this
->parse()) {
$xpath = $this
->buildXPathQuery($xpath, $arguments);
$result = $this->elements
->xpath($xpath);
// Some combinations of PHP / libxml versions return an empty array
// instead of the documented FALSE. Forcefully convert any falsish values
// to an empty array to allow foreach(...) constructions.
return $result ? $result : array();
}
else {
return FALSE;
}
}