Test/PHPUnit/Constraint/DomQuery.php
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Test
- Subpackage
- PHPUnit
- Version
- $Id: DomQuery.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Test_PHPUnit_Constraint_DomQuery
- Parent(s)
- \PHPUnit_Framework_Constraint
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
- \global\PHPUnit_Framework_Constraint
Constants
Properties


array $_assertTypes = array(self::ASSERT_QUERY, self::ASSERT_CONTENT_CONTAINS, self::ASSERT_CONTENT_REGEX, self::ASSERT_CONTENT_COUNT, self::ASSERT_CONTENT_COUNT_MIN, self::ASSERT_CONTENT_COUNT_MAX)
array(self::ASSERT_QUERY, self::ASSERT_CONTENT_CONTAINS, self::ASSERT_CONTENT_REGEX, self::ASSERT_CONTENT_COUNT, self::ASSERT_CONTENT_COUNT_MIN, self::ASSERT_CONTENT_COUNT_MAX)
Details- Type
- array
Methods


__construct(string $path) : void
Constructor; setup constraint state
Name | Type | Description |
---|---|---|
$path | string | CSS selector path |


_countContent(\Zend_Dom_Query_Result $result, int $test, string $type) : boolean
Determine if content count matches criteria
Name | Type | Description |
---|---|---|
$result | \Zend_Dom_Query_Result | |
$test | int | Value against which to test |
$type | string | assertion type |
Type | Description |
---|---|
boolean |


_getNodeContent(\DOMNode $node) : string
Get node content, minus node markup tags
Name | Type | Description |
---|---|---|
$node | \DOMNode |
Type | Description |
---|---|
string |


_matchContent(\Zend_Dom_Query_Result $result, string $match) : bool
Check to see if content is matched in selected nodes
Name | Type | Description |
---|---|---|
$result | \Zend_Dom_Query_Result | |
$match | string | Content to match |
Type | Description |
---|---|
bool |


_notMatchContent(\Zend_Dom_Query_Result $result, string $match) : bool
Check to see if content is NOT matched in selected nodes
Name | Type | Description |
---|---|---|
$result | \Zend_Dom_Query_Result | |
$match | string |
Type | Description |
---|---|
bool |


_notRegexContent(\Zend_Dom_Query_Result $result, string $pattern) : bool
Check to see if content is NOT matched by regex in selected nodes
Name | Type | Description |
---|---|---|
$result | \Zend_Dom_Query_Result | |
$pattern | string |
Type | Description |
---|---|
bool |


_regexContent(\Zend_Dom_Query_Result $result, string $pattern) : bool
Check to see if content is matched by regex in selected nodes
Name | Type | Description |
---|---|---|
$result | \Zend_Dom_Query_Result | |
$pattern | string |
Type | Description |
---|---|
bool |


evaluate(string $other, null | string $assertType = null) : bool
Evaluate an object to see if it fits the constraints
Name | Type | Description |
---|---|---|
$other | string | String to examine |
$assertType | null | string | Assertion type |
Type | Description |
---|---|
bool |


fail(mixed $other, string $description, bool $not = false) : void
Report Failure
Name | Type | Description |
---|---|---|
$other | mixed | CSS selector path |
$description | string | |
$not | bool |
Exception | Description |
---|---|
\PHPUnit_Framework_ExpectationFailedException |
- See
- for implementation details


registerXpathNamespaces(array $xpathNamespaces) : void
Register XPath namespaces
Name | Type | Description |
---|---|---|
$xpathNamespaces | array |


setUseXpath(bool $flag = true) : \Zend_Test_PHPUnit_Constraint_DomQuery
Whether or not path is a straight XPath expression
Name | Type | Description |
---|---|---|
$flag | bool |
Type | Description |
---|---|
\Zend_Test_PHPUnit_Constraint_DomQuery |