本文整理汇总了PHP中PHPUnit_Util_XML::convertSelectToTag方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Util_XML::convertSelectToTag方法的具体用法?PHP PHPUnit_Util_XML::convertSelectToTag怎么用?PHP PHPUnit_Util_XML::convertSelectToTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPUnit_Util_XML
的用法示例。
在下文中一共展示了PHPUnit_Util_XML::convertSelectToTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testConvertAssertRange
public function testConvertAssertRange()
{
$selector = '#foo';
$content = array('greater_than' => 5, 'less_than' => 10);
$converted = PHPUnit_Util_XML::convertSelectToTag($selector, $content);
$tag = array('id' => 'foo');
$this->assertEquals($tag, $converted);
}
示例2: doXmlSelect
/**
* @param string $selector
* @param DOMDocument $actual
* @param string $message
* @param mixed $content
* @param boolean $exists
* @since Method available since Release 3.3.0
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
*/
protected static function doXmlSelect($selector, DOMDocument $actual, $message, $content, $exists)
{
$options = PHPUnit_Util_XML::convertSelectToTag($selector, $content);
$tags = PHPUnit_Util_XML::findNodes($actual, $options);
// check if any elements exist with given content
if (is_bool($content) || is_string($content)) {
if ($content === TRUE) {
self::assertFalse($tags, $message);
} else {
if ($exists === TRUE) {
self::assertTrue(count($tags) > 0 && $tags[0] instanceof DOMNode, $message);
} else {
if ($exists === FALSE) {
self::assertFalse(count($tags) > 0 && $tags[0] instanceof DOMNode, $message);
}
}
}
} else {
if (is_numeric($content)) {
$tagCount = $tags ? count($tags) : 0;
self::assertEquals($content, $tagCount);
} else {
if (is_array($content) && (isset($content['>']) || isset($content['<']) || isset($content['>=']) || isset($content['<=']))) {
$tagCount = $tags ? count($tags) : 0;
if (isset($content['>'])) {
self::assertTrue($tagCount > $content['>'], $message);
}
if (isset($content['>='])) {
self::assertTrue($tagCount >= $content['>='], $message);
}
if (isset($content['<'])) {
self::assertTrue($tagCount < $content['<'], $message);
}
if (isset($content['<='])) {
self::assertTrue($tagCount <= $content['<='], $message);
}
} else {
throw new InvalidArgumentException();
}
}
}
}