public static function PHPUnit_Util_XML::cssSelect

Parse an $actual document and return an array of DOMNodes matching the CSS $selector. If an error occurs, it will return FALSE.

To only return nodes containing a certain content, give the $content to match as a string. Otherwise, setting $content to TRUE will return all nodes matching $selector.

The $actual document may be a DOMDocument or a string containing XML or HTML, identified by $isHtml.

@since Method available since Release 3.3.0 @author Mike Naberezny <mike@maintainable.com> @author Derek DeVries <derek@maintainable.com> @author Tobias Schlitt <toby@php.net>

Parameters

array $selector:

string $content:

mixed $actual:

boolean $isHtml:

Return value

false|array

1 call to PHPUnit_Util_XML::cssSelect()
PHPUnit_Framework_Assert::assertSelectEquals in drupal/core/vendor/phpunit/phpunit/PHPUnit/Framework/Assert.php
assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none?

File

drupal/core/vendor/phpunit/phpunit/PHPUnit/Util/XML.php, line 481

Class

PHPUnit_Util_XML
XML helpers.

Code

public static function cssSelect($selector, $content, $actual, $isHtml = TRUE) {
  $matcher = self::convertSelectToTag($selector, $content);
  $dom = self::load($actual, $isHtml);
  $tags = self::findNodes($dom, $matcher, $isHtml);
  return $tags;
}