Test/PHPUnit/Constraint/DomQuery37.php
Zend Framework
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-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Test
- Subpackage
- PHPUnit
- Version
- $Id$
\Zend_Test_PHPUnit_Constraint_DomQuery
Package: Zend_Test\PHPUnit











Zend_Dom_Query-based PHPUnit Constraint
- Parent(s)
- \PHPUnit_Framework_Constraint
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
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)Available assertion types
Default value
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) : voidConstructor; setup constraint state
Parameters
| Name | Type | Description |
|---|---|---|
| $path | string | CSS selector path |

_countContent(\Zend_Dom_Query_Result $result, int $test, string $type) : booleanDetermine if content count matches criteria
Parameters
Returns
| 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) : stringGet node content, minus node markup tags
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $node | \DOMNode |
| Type | Description |
|---|---|
| string |

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

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

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

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

evaluate( $content, $assertType = '', $match = FALSE) : boolEvaluate an object to see if it fits the constraints
Parameters
Returns
| Name | Type | Description |
|---|---|---|
| $content | ||
| $assertType | ||
| $match |
| Type | Description |
|---|---|
| bool | NOTE: Drastic changes up to PHPUnit 3.5.15 this was: public function evaluate($other, $assertType = null) In PHPUnit 3.6.0 they changed the interface into this: public function evaluate($other, $description = '', $returnResult = FALSE) We use the new interface for PHP-strict checking, but emulate the old one |

fail( $other, $description, $cannot_be_used = NULL) : voidReport Failure
Parameters
Throws
Details
| Name | Type | Description |
|---|---|---|
| $other | ||
| $description | ||
| $cannot_be_used |
| Exception | Description |
|---|---|
| \PHPUnit_Framework_ExpectationFailedException | NOTE: Drastic changes up to PHPUnit 3.5.15 this was: public function fail($other, $description, $not = false) In PHPUnit 3.6.0 they changed the interface into this: protected function fail($other, $description, PHPUnit_Framework_ComparisonFailure $comparisonFailure = NULL) We use the new interface for PHP-strict checking |

registerXpathNamespaces(array $xpathNamespaces) : voidRegister XPath namespaces
Parameters
| Name | Type | Description |
|---|---|---|
| $xpathNamespaces | array |

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