You are here

public static function PHPUnit_Util_XML::cssSelect in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/src/Util/XML.php \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

Parameters

array $selector:

string $content:

mixed $actual:

bool $isHtml:

Return value

bool|array

2 calls to PHPUnit_Util_XML::cssSelect()
PHPUnit_Framework_Assert::assertSelectEquals in vendor/phpunit/phpunit/src/Framework/Assert.php
assertSelectEquals("#binder .name", "Chuck", true, $xml); // any? assertSelectEquals("#binder .name", "Chuck", false, $xml); // none?
TourTestBase::assertTourTips in core/modules/tour/src/Tests/TourTestBase.php
Assert function to determine if tips rendered to the page have a corresponding page element.

File

vendor/phpunit/phpunit/src/Util/XML.php, line 445

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