本文整理汇总了PHP中PHPUnit_Util_XML::findNodes方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_XML::findNodes方法的具体用法?PHP PHPUnit_Util_XML::findNodes怎么用?PHP PHPUnit_Util_XML::findNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_XML
的用法示例。
在下文中一共展示了PHPUnit_Util_XML::findNodes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertNotTag
/**
* Note: we are overriding this method to remove the deprecated error
* @see https://tracker.moodle.org/browse/MDL-47129
*
* @param array $matcher
* @param string $actual
* @param string $message
* @param boolean $ishtml
*
* @deprecated 3.0
*/
public static function assertNotTag($matcher, $actual, $message = '', $ishtml = true)
{
$dom = PHPUnit_Util_XML::load($actual, $ishtml);
$tags = PHPUnit_Util_XML::findNodes($dom, $matcher, $ishtml);
$matched = count($tags) > 0 && $tags[0] instanceof DOMNode;
self::assertFalse($matched, $message);
}
示例2: findElementContent
private function findElementContent($html, $matcher)
{
$el = \PHPUnit_Util_XML::findNodes(dom_import_simplexml(simplexml_load_string($html))->ownerDocument, $matcher);
if ($el === false) {
return false;
}
return $el[0]->textContent;
}
示例3: assertNotTag
/**
* This assertion is the exact opposite of assertTag().
*
* Rather than asserting that $matcher results in a match, it asserts that
* $matcher does not match.
*
* @param array $matcher
* @param string $actual
* @param string $message
* @param bool $isHtml
* @since Method available since Release 3.3.0
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
* @deprecated
*/
public static function assertNotTag($matcher, $actual, $message = '', $isHtml = true)
{
trigger_error(__METHOD__ . ' is deprecated', E_USER_DEPRECATED);
$dom = PHPUnit_Util_XML::load($actual, $isHtml);
$tags = PHPUnit_Util_XML::findNodes($dom, $matcher, $isHtml);
$matched = count($tags) > 0 && $tags[0] instanceof DOMNode;
self::assertFalse($matched, $message);
}
示例4: tagMatch
/**
* @param array $matcher
* @param string $actual
* @param bool $isHtml
*
* @return bool
*/
private static function tagMatch($matcher, $actual, $isHtml = true)
{
$dom = PHPUnit_Util_XML::load($actual, $isHtml);
$tags = PHPUnit_Util_XML::findNodes($dom, $matcher, $isHtml);
return count($tags) > 0 && $tags[0] instanceof DOMNode;
}
示例5: doXmlTag
/**
* @param array $options
* @param DOMDocument $actual
* @return boolean
* @since Method available since Release 3.3.0
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
*/
protected static function doXmlTag(array $options, DOMDocument $actual)
{
$tags = PHPUnit_Util_XML::findNodes($actual, $options);
return count($tags) > 0 && $tags[0] instanceof DOMNode;
}