Test/PHPUnit/Constraint/DomQuery34.php

Show: PublicProtectedPrivateinherited
Table of Contents
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 [email protected] 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

>VConstant  ASSERT_QUERY = 'assertQuery'
>VConstant  ASSERT_CONTENT_CONTAINS = 'assertQueryContentContains'
>VConstant  ASSERT_CONTENT_REGEX = 'assertQueryContentRegex'
>VConstant  ASSERT_CONTENT_COUNT = 'assertQueryCount'
>VConstant  ASSERT_CONTENT_COUNT_MIN = 'assertQueryCountMin'
>VConstant  ASSERT_CONTENT_COUNT_MAX = 'assertQueryCountMax'

Properties

>VPropertyprotectedstring $_assertType = null
Current assertion type
Default valuenullDetails
Type
string
>VPropertyprotectedarray $_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 valuearray(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
>VPropertyprotectedstring $_content = null
Content being matched
Default valuenullDetails
Type
string
>VPropertyprotectedbool $_negate = false
Whether or not assertion is negated
Default valuefalseDetails
Type
bool
>VPropertyprotectedstring $_path = null
CSS selector or XPath path to select against
Default valuenullDetails
Type
string
>VPropertyprotectedbool $_useXpath = false
Whether or not to use XPath when querying
Default valuefalseDetails
Type
bool
>VPropertyprotectedarray $_xpathNamespaces = array()
XPath namespaces
Default valuearray()Details
Type
array

Methods

methodpublic__construct(string $path) : void

Constructor; setup constraint state

Parameters
NameTypeDescription
$pathstring

CSS selector path

methodprotected_countContent(\Zend_Dom_Query_Result $result, int $test, string $type) : boolean

Determine if content count matches criteria

Parameters
NameTypeDescription
$result\Zend_Dom_Query_Result
$testint

Value against which to test

$typestring

assertion type

Returns
TypeDescription
boolean
methodprotected_getNodeContent(\DOMNode $node) : string

Get node content, minus node markup tags

Parameters
NameTypeDescription
$node\DOMNode
Returns
TypeDescription
string
methodprotected_matchContent(\Zend_Dom_Query_Result $result, string $match) : bool

Check to see if content is matched in selected nodes

Parameters
NameTypeDescription
$result\Zend_Dom_Query_Result
$matchstring

Content to match

Returns
TypeDescription
bool
methodprotected_notMatchContent(\Zend_Dom_Query_Result $result, string $match) : bool

Check to see if content is NOT matched in selected nodes

Parameters
NameTypeDescription
$result\Zend_Dom_Query_Result
$matchstring
Returns
TypeDescription
bool
methodprotected_notRegexContent(\Zend_Dom_Query_Result $result, string $pattern) : bool

Check to see if content is NOT matched by regex in selected nodes

Parameters
NameTypeDescription
$result\Zend_Dom_Query_Result
$patternstring
Returns
TypeDescription
bool
methodprotected_regexContent(\Zend_Dom_Query_Result $result, string $pattern) : bool

Check to see if content is matched by regex in selected nodes

Parameters
NameTypeDescription
$result\Zend_Dom_Query_Result
$patternstring
Returns
TypeDescription
bool
methodpublicevaluate(string $other,  $assertType = null) : bool

Evaluate an object to see if it fits the constraints

Parameters
NameTypeDescription
$otherstring

String to examine

$assertType
Returns
TypeDescription
bool
methodpublicfail(mixed $other, string $description, bool $not = false) : void

Report Failure

Parameters
NameTypeDescription
$othermixed

CSS selector path

$descriptionstring
$notbool
Throws
ExceptionDescription
\PHPUnit_Framework_ExpectationFailedException
Details
See
for implementation details  
methodpublicregisterXpathNamespaces(array $xpathNamespaces) : void

Register XPath namespaces

Parameters
NameTypeDescription
$xpathNamespacesarray
methodpublicsetNegate(bool $flag = true) : void

Indicate negative match

Parameters
NameTypeDescription
$flagbool
methodpublicsetUseXpath(bool $flag = true) : \Zend_Test_PHPUnit_Constraint_DomQuery

Whether or not path is a straight XPath expression

Parameters
NameTypeDescription
$flagbool
Returns
TypeDescription
\Zend_Test_PHPUnit_Constraint_DomQuery
methodpublictoString() : string

Complete implementation

Returns
TypeDescription
string
Documentation was generated by phpDocumentor 2.2.0 .