Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Zend_Test_PHPUnit_Constraint_DomQuery Class Reference

Public Member Functions

 __construct ($path)
 Constructor; setup constraint state.
 
 setNegate ($flag=true)
 Indicate negative match.
 
 setUseXpath ($flag=true)
 Whether or not path is a straight XPath expression.
 
 evaluate ($other, $assertType=null)
 Evaluate an object to see if it fits the constraints.
 
 fail ($other, $description, $not=false)
 Report Failure.
 
 toString ()
 Complete implementation.
 
 registerXpathNamespaces ($xpathNamespaces)
 Register XPath namespaces.
 
 __construct ($path)
 Constructor; setup constraint state.
 
 setNegate ($flag=true)
 Indicate negative match.
 
 setUseXpath ($flag=true)
 Whether or not path is a straight XPath expression.
 
 evaluate ($content, $assertType= '', $match=FALSE)
 Evaluate an object to see if it fits the constraints.
 
 fail ($other, $description, PHPUnit_Framework_ComparisonFailure $cannot_be_used=NULL)
 Report Failure.
 
 toString ()
 Complete implementation.
 
 registerXpathNamespaces ($xpathNamespaces)
 Register XPath namespaces.
 

Public Attributes

const ASSERT_QUERY = 'assertQuery'
 #@+ Assertion type constants
 
const ASSERT_CONTENT_CONTAINS = 'assertQueryContentContains'
 
const ASSERT_CONTENT_REGEX = 'assertQueryContentRegex'
 
const ASSERT_CONTENT_COUNT = 'assertQueryCount'
 
const ASSERT_CONTENT_COUNT_MIN = 'assertQueryCountMin'
 
const ASSERT_CONTENT_COUNT_MAX = 'assertQueryCountMax'
 

Protected Member Functions

 _matchContent ($result, $match)
 Check to see if content is matched in selected nodes.
 
 _notMatchContent ($result, $match)
 Check to see if content is NOT matched in selected nodes.
 
 _regexContent ($result, $pattern)
 Check to see if content is matched by regex in selected nodes.
 
 _notRegexContent ($result, $pattern)
 Check to see if content is NOT matched by regex in selected nodes.
 
 _countContent ($result, $test, $type)
 Determine if content count matches criteria.
 
 _getNodeContent (DOMNode $node)
 Get node content, minus node markup tags.
 
 _matchContent ($result, $match)
 Check to see if content is matched in selected nodes.
 
 _notMatchContent ($result, $match)
 Check to see if content is NOT matched in selected nodes.
 
 _regexContent ($result, $pattern)
 Check to see if content is matched by regex in selected nodes.
 
 _notRegexContent ($result, $pattern)
 Check to see if content is NOT matched by regex in selected nodes.
 
 _countContent ($result, $test, $type)
 Determine if content count matches criteria.
 
 _getNodeContent (DOMNode $node)
 Get node content, minus node markup tags.
 

Protected Attributes

 $_assertType = null
 
 $_assertTypes
 
 $_content = null
 
 $_negate = false
 
 $_path = null
 
 $_useXpath = false
 
 $_xpathNamespaces = array()
 

Constructor & Destructor Documentation

__construct (   $path)

Constructor; setup constraint state.

Parameters
string$pathCSS selector path
Returns
void
__construct (   $path)

Constructor; setup constraint state.

Parameters
string$pathCSS selector path
Returns
void

Member Function Documentation

_countContent (   $result,
  $test,
  $type 
)
protected

Determine if content count matches criteria.

Parameters
Zend_Dom_Query_Result$result
int$testValue against which to test
string$typeassertion type
Returns
boolean
_countContent (   $result,
  $test,
  $type 
)
protected

Determine if content count matches criteria.

Parameters
Zend_Dom_Query_Result$result
int$testValue against which to test
string$typeassertion type
Returns
boolean
_getNodeContent ( DOMNode  $node)
protected

Get node content, minus node markup tags.

Parameters
DOMNode$node
Returns
string
_getNodeContent ( DOMNode  $node)
protected

Get node content, minus node markup tags.

Parameters
DOMNode$node
Returns
string
_matchContent (   $result,
  $match 
)
protected

Check to see if content is matched in selected nodes.

Parameters
Zend_Dom_Query_Result$result
string$matchContent to match
Returns
bool
_matchContent (   $result,
  $match 
)
protected

Check to see if content is matched in selected nodes.

Parameters
Zend_Dom_Query_Result$result
string$matchContent to match
Returns
bool
_notMatchContent (   $result,
  $match 
)
protected

Check to see if content is NOT matched in selected nodes.

Parameters
Zend_Dom_Query_Result$result
string$match
Returns
bool
_notMatchContent (   $result,
  $match 
)
protected

Check to see if content is NOT matched in selected nodes.

Parameters
Zend_Dom_Query_Result$result
string$match
Returns
bool
_notRegexContent (   $result,
  $pattern 
)
protected

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

Parameters
Zend_Dom_Query_Result$result
string$pattern
Returns
bool
_notRegexContent (   $result,
  $pattern 
)
protected

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

Parameters
Zend_Dom_Query_Result$result
string$pattern
Returns
bool
_regexContent (   $result,
  $pattern 
)
protected

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

Parameters
Zend_Dom_Query_Result$result
string$pattern
Returns
bool
_regexContent (   $result,
  $pattern 
)
protected

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

Parameters
Zend_Dom_Query_Result$result
string$pattern
Returns
bool
evaluate (   $other,
  $assertType = null 
)

Evaluate an object to see if it fits the constraints.

Parameters
string$otherString to examine
null|stringAssertion type
Returns
bool
evaluate (   $content,
  $assertType = '',
  $match = FALSE 
)

Evaluate an object to see if it fits the constraints.

Parameters
stringResponse content to be matched against (haystack)
null|stringAssertion type
string(optional) String to match (needle), may be required depending on assertion type
Returns
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,
  $not = false 
)

Report Failure.

See Also
PHPUnit_Framework_Constraint for implementation details
Parameters
mixed$otherCSS selector path
string$description
bool$not
Returns
void
Exceptions
PHPUnit_Framework_ExpectationFailedException
fail (   $other,
  $description,
PHPUnit_Framework_ComparisonFailure  $cannot_be_used = NULL 
)

Report Failure.

See Also
PHPUnit_Framework_Constraint for implementation details
Parameters
mixedCSS selector path
stringFailure description
objectCannot be used, null
Returns
void
Exceptions
PHPUnit_Framework_ExpectationFailedExceptionNOTE: 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 (   $xpathNamespaces)

Register XPath namespaces.

Parameters
array$xpathNamespaces
Returns
void
registerXpathNamespaces (   $xpathNamespaces)

Register XPath namespaces.

Parameters
array$xpathNamespaces
Returns
void
setNegate (   $flag = true)

Indicate negative match.

Parameters
bool$flag
Returns
void
setNegate (   $flag = true)

Indicate negative match.

Parameters
bool$flag
Returns
void
setUseXpath (   $flag = true)

Whether or not path is a straight XPath expression.

Parameters
bool$flag
Returns
Zend_Test_PHPUnit_Constraint_DomQuery
setUseXpath (   $flag = true)

Whether or not path is a straight XPath expression.

Parameters
bool$flag
Returns
Zend_Test_PHPUnit_Constraint_DomQuery
toString ( )

Complete implementation.

Returns
string
toString ( )

Complete implementation.

Returns
string

Member Data Documentation

$_assertType = null
protected
$_assertTypes
protected
Initial 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,
)
$_content = null
protected
$_negate = false
protected
$_path = null
protected
$_useXpath = false
protected
$_xpathNamespaces = array()
protected
const ASSERT_CONTENT_CONTAINS = 'assertQueryContentContains'
const ASSERT_CONTENT_COUNT = 'assertQueryCount'
const ASSERT_CONTENT_COUNT_MAX = 'assertQueryCountMax'
const ASSERT_CONTENT_COUNT_MIN = 'assertQueryCountMin'
const ASSERT_CONTENT_REGEX = 'assertQueryContentRegex'
const ASSERT_QUERY = 'assertQuery'

#@+ Assertion type constants