protected function DrupalWebTestCase::xpath

7.x drupal_web_test_case.php protected DrupalWebTestCase::xpath($xpath, array $arguments = array())

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.

107 calls to DrupalWebTestCase::xpath()
AggregatorRenderingTestCase::testBlockLinks in drupal-7.x/modules/aggregator/aggregator.test
Adds a feed block to the page and checks its links.
AggregatorRenderingTestCase::testFeedPage in drupal-7.x/modules/aggregator/aggregator.test
Creates a feed and checks that feed's page.
AJAXMultiFormTestCase::testMultiForm in drupal-7.x/modules/simpletest/tests/ajax.test
Test that a page with the 'page_node_form' included twice works correctly.
BlockTestCase::testCustomBlock in drupal-7.x/modules/block/block.test
Test creating custom block, moving it to a specific region and then deleting it.
BookTestCase::checkBookNode in drupal-7.x/modules/book/book.test
Checks the outline of sub-pages; previous, up, and next.

... See full list

File

drupal-7.x/modules/simpletest/drupal_web_test_case.php, line 2548

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;
  }
}