protected function DrupalWebTestCase::xpath in SimpleTest 6.2
Same name and namespace in other branches
- 7.2 drupal_web_test_case.php \DrupalWebTestCase::xpath()
- 7 drupal_web_test_case.php \DrupalWebTestCase::xpath()
Perform 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
$xpath: The xpath string to use in the search.
Return value
The return value of the xpath search. For details on the xpath string format and return values see the SimpleXML documentation, http://us.php.net/manual/function.simplexml-element-xpath.php.
18 calls to DrupalWebTestCase::xpath()
- DrupalWebTestCase::assertFieldByXPath in ./
drupal_web_test_case.php - Asserts that a field exists in the current page by the given XPath.
- DrupalWebTestCase::assertFieldChecked in ./
drupal_web_test_case.php - Asserts that a checkbox field in the current page is checked.
- DrupalWebTestCase::assertLink in ./
drupal_web_test_case.php - Pass if a link with the specified label is found, and optional with the specified index.
- DrupalWebTestCase::assertLinkByHref in ./
drupal_web_test_case.php - Pass if a link containing a given href (part) is found.
- DrupalWebTestCase::assertNoDuplicateIds in ./
drupal_web_test_case.php - Asserts that each HTML ID is used for just a single element.
File
- ./
drupal_web_test_case.php, line 2024
Class
- DrupalWebTestCase
- Test case for typical Drupal tests.
Code
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;
}
}