API Documentation

Test/PHPUnit/Constraint/DomQuery.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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Test  
subpackage
PHPUnit  
version
$Id: DomQuery.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_Test_PHPUnit_Constraint_DomQuery

Zend_Dom_Query-based PHPUnit Constraint

Extends from
\PHPUnit_Framework_Constraint
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Test  
subpackage
PHPUnit  
uses
\PHPUnit_Framework_Constraint  

Constants

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

Properties

Propertyprotectedstring  $_assertType= 'null'

Current assertion type

Default valuenullDetails
Type
string
Propertyprotectedarray  $_assertTypes= 'array'

Available assertion types

Default valuearrayDetails
Type
array
Propertyprotectedstring  $_content= 'null'

Content being matched

Default valuenullDetails
Type
string
Propertyprotectedbool  $_negate= 'false'

Whether or not assertion is negated

Default valuefalseDetails
Type
bool
Propertyprotectedstring  $_path= 'null'

CSS selector or XPath path to select against

Default valuenullDetails
Type
string
Propertyprotectedbool  $_useXpath= 'false'

Whether or not to use XPath when querying

Default valuefalseDetails
Type
bool
Propertyprotectedarray  $_xpathNamespaces= 'array'

XPath namespaces

Default valuearrayDetails
Type
array

Methods

methodpublic__construct( string $path ) : void

Constructor; setup constraint state

Parameters
Name Type Description
$path string CSS selector path
methodprotected_countContent( \Zend_Dom_Query_Result $result, int $test, string $type ) : boolean

Determine if content count matches criteria

Parameters
Name Type Description
$result \Zend_Dom_Query_Result
$test int Value against which to test
$type string assertion type
Returns
Type Description
boolean
methodprotected_getNodeContent( \DOMNode $node ) : string

Get node content, minus node markup tags

Parameters
Name Type Description
$node \DOMNode
Returns
Type Description
string
methodprotected_matchContent( \Zend_Dom_Query_Result $result, string $match ) : bool

Check to see if content is matched in selected nodes

Parameters
Name Type Description
$result \Zend_Dom_Query_Result
$match string Content to match
Returns
Type Description
bool
methodprotected_notMatchContent( \Zend_Dom_Query_Result $result, string $match ) : bool

Check to see if content is NOT matched in selected nodes

Parameters
Name Type Description
$result \Zend_Dom_Query_Result
$match string
Returns
Type Description
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
Name Type Description
$result \Zend_Dom_Query_Result
$pattern string
Returns
Type Description
bool
methodprotected_regexContent( \Zend_Dom_Query_Result $result, string $pattern ) : bool

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

Parameters
Name Type Description
$result \Zend_Dom_Query_Result
$pattern string
Returns
Type Description
bool
methodpubliccount( ) : void

Inherited from:
methodprotectedcustomFailureDescription( ) : void

Inherited from:
methodpublicevaluate( string $other, null|string $assertType = null ) : bool

Evaluate an object to see if it fits the constraints

Parameters
Name Type Description
$other string String to examine
$assertType null|string Assertion type
Returns
Type Description
bool
methodpublicfail( mixed $other, string $description, bool $not = false ) : void

Report Failure

Parameters
Name Type Description
$other mixed CSS selector path
$description string
$not bool
Throws
Exception Description
\PHPUnit_Framework_ExpectationFailedException
Details
see
\PHPUnit_Framework_Constraint  
methodprotectedfailureDescription( ) : void

Inherited from:
methodpublicnegate( ) : void
static

Inherited from:
methodpublicregisterXpathNamespaces( array $xpathNamespaces ) : void

Register XPath namespaces

Parameters
Name Type Description
$xpathNamespaces array
methodpublicsetNegate( bool $flag = true ) : void

Indicate negative match

Parameters
Name Type Description
$flag bool
methodpublicsetUseXpath( bool $flag = true ) : \Zend_Test_PHPUnit_Constraint_DomQuery

Whether or not path is a straight XPath expression

Parameters
Name Type Description
$flag bool
Returns
Type Description
\Zend_Test_PHPUnit_Constraint_DomQuery
methodpublictoString( ) : string

Complete implementation

Returns
Type Description
string
Documentation was generated by DocBlox 0.13.3.