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

Public Member Functions

 __construct ()
 Constructor; setup constraint state.
 
 setNegate ($flag=true)
 Indicate negative match.
 
 evaluate ($other, $assertType=null)
 Evaluate an object to see if it fits the constraints.
 
 fail ($other, $description, $not=false)
 Report Failure.
 
 toString ()
 Complete implementation.
 
 __construct ()
 Constructor; setup constraint state.
 
 setNegate ($flag=true)
 Indicate negative match.
 
 evaluate ($response, $assertType= '', $variable=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.
 

Public Attributes

const ASSERT_RESPONSE_CODE = 'assertResponseCode'
 #@+ Assertion type constants
 
const ASSERT_HEADER = 'assertHeader'
 
const ASSERT_HEADER_CONTAINS = 'assertHeaderContains'
 
const ASSERT_HEADER_REGEX = 'assertHeaderRegex'
 

Protected Member Functions

 _code (Zend_Controller_Response_Abstract $response, $code)
 Compare response code for positive match.
 
 _notCode (Zend_Controller_Response_Abstract $response, $code)
 Compare response code for negative match.
 
 _getCode (Zend_Controller_Response_Abstract $response)
 Retrieve response code.
 
 _header (Zend_Controller_Response_Abstract $response, $header)
 Positive check for response header presence.
 
 _notHeader (Zend_Controller_Response_Abstract $response, $header)
 Negative check for response header presence.
 
 _getHeader (Zend_Controller_Response_Abstract $response, $header)
 Retrieve response header.
 
 _headerContains (Zend_Controller_Response_Abstract $response, $header, $match)
 Positive check for header contents matching pattern.
 
 _notHeaderContains (Zend_Controller_Response_Abstract $response, $header, $match)
 Negative check for header contents matching pattern.
 
 _headerRegex (Zend_Controller_Response_Abstract $response, $header, $pattern)
 Positive check for header contents matching regex.
 
 _notHeaderRegex (Zend_Controller_Response_Abstract $response, $header, $pattern)
 Negative check for header contents matching regex.
 
 _code (Zend_Controller_Response_Abstract $response, $code)
 Compare response code for positive match.
 
 _notCode (Zend_Controller_Response_Abstract $response, $code)
 Compare response code for negative match.
 
 _getCode (Zend_Controller_Response_Abstract $response)
 Retrieve response code.
 
 _header (Zend_Controller_Response_Abstract $response, $header)
 Positive check for response header presence.
 
 _notHeader (Zend_Controller_Response_Abstract $response, $header)
 Negative check for response header presence.
 
 _getHeader (Zend_Controller_Response_Abstract $response, $header)
 Retrieve response header.
 
 _headerContains (Zend_Controller_Response_Abstract $response, $header, $match)
 Positive check for header contents matching pattern.
 
 _notHeaderContains (Zend_Controller_Response_Abstract $response, $header, $match)
 Negative check for header contents matching pattern.
 
 _headerRegex (Zend_Controller_Response_Abstract $response, $header, $pattern)
 Positive check for header contents matching regex.
 
 _notHeaderRegex (Zend_Controller_Response_Abstract $response, $header, $pattern)
 Negative check for header contents matching regex.
 

Protected Attributes

 $_assertType = null
 
 $_assertTypes
 
 $_code = 200
 
 $_actualCode = null
 
 $_header = null
 
 $_match = null
 
 $_negate = false
 

Constructor & Destructor Documentation

__construct ( )

Constructor; setup constraint state.

Returns
void
__construct ( )

Constructor; setup constraint state.

Returns
void

Member Function Documentation

_code ( Zend_Controller_Response_Abstract  $response,
  $code 
)
protected

Compare response code for positive match.

Parameters
Zend_Controller_Response_Abstract$response
int$code
Returns
bool
_code ( Zend_Controller_Response_Abstract  $response,
  $code 
)
protected

Compare response code for positive match.

Parameters
Zend_Controller_Response_Abstract$response
int$code
Returns
bool
_getCode ( Zend_Controller_Response_Abstract  $response)
protected

Retrieve response code.

Parameters
Zend_Controller_Response_Abstract$response
Returns
int
_getCode ( Zend_Controller_Response_Abstract  $response)
protected

Retrieve response code.

Parameters
Zend_Controller_Response_Abstract$response
Returns
int
_getHeader ( Zend_Controller_Response_Abstract  $response,
  $header 
)
protected

Retrieve response header.

Parameters
Zend_Controller_Response_Abstract$response
string$header
Returns
string|null
_getHeader ( Zend_Controller_Response_Abstract  $response,
  $header 
)
protected

Retrieve response header.

Parameters
Zend_Controller_Response_Abstract$response
string$header
Returns
string|null
_header ( Zend_Controller_Response_Abstract  $response,
  $header 
)
protected

Positive check for response header presence.

Parameters
Zend_Controller_Response_Abstract$response
string$header
Returns
bool
_header ( Zend_Controller_Response_Abstract  $response,
  $header 
)
protected

Positive check for response header presence.

Parameters
Zend_Controller_Response_Abstract$response
string$header
Returns
bool
_headerContains ( Zend_Controller_Response_Abstract  $response,
  $header,
  $match 
)
protected

Positive check for header contents matching pattern.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$match
Returns
bool
_headerContains ( Zend_Controller_Response_Abstract  $response,
  $header,
  $match 
)
protected

Positive check for header contents matching pattern.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$match
Returns
bool
_headerRegex ( Zend_Controller_Response_Abstract  $response,
  $header,
  $pattern 
)
protected

Positive check for header contents matching regex.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$pattern
Returns
bool
_headerRegex ( Zend_Controller_Response_Abstract  $response,
  $header,
  $pattern 
)
protected

Positive check for header contents matching regex.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$pattern
Returns
bool
_notCode ( Zend_Controller_Response_Abstract  $response,
  $code 
)
protected

Compare response code for negative match.

Parameters
Zend_Controller_Response_Abstract$response
int$code
Returns
bool
_notCode ( Zend_Controller_Response_Abstract  $response,
  $code 
)
protected

Compare response code for negative match.

Parameters
Zend_Controller_Response_Abstract$response
int$code
Returns
bool
_notHeader ( Zend_Controller_Response_Abstract  $response,
  $header 
)
protected

Negative check for response header presence.

Parameters
Zend_Controller_Response_Abstract$response
string$header
Returns
bool
_notHeader ( Zend_Controller_Response_Abstract  $response,
  $header 
)
protected

Negative check for response header presence.

Parameters
Zend_Controller_Response_Abstract$response
string$header
Returns
bool
_notHeaderContains ( Zend_Controller_Response_Abstract  $response,
  $header,
  $match 
)
protected

Negative check for header contents matching pattern.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$match
Returns
bool
_notHeaderContains ( Zend_Controller_Response_Abstract  $response,
  $header,
  $match 
)
protected

Negative check for header contents matching pattern.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$match
Returns
bool
_notHeaderRegex ( Zend_Controller_Response_Abstract  $response,
  $header,
  $pattern 
)
protected

Negative check for header contents matching regex.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$pattern
Returns
bool
_notHeaderRegex ( Zend_Controller_Response_Abstract  $response,
  $header,
  $pattern 
)
protected

Negative check for header contents matching regex.

Parameters
Zend_Controller_Response_Abstract$response
string$header
string$pattern
Returns
bool
evaluate (   $other,
  $assertType = null 
)

Evaluate an object to see if it fits the constraints.

Parameters
Zend_Controller_Response_Abstract$otherString to examine
null|stringAssertion type
Returns
bool
evaluate (   $response,
  $assertType = '',
  $variable = FALSE 
)

Evaluate an object to see if it fits the constraints.

Parameters
objectof Zend_Controller_Response_Abstract to be evaluated
null|stringAssertion type
int|stringHTTP response code to evaluate against | header string (haystack)
string(optional) 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$other
string$descriptionAdditional message to display
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
setNegate (   $flag = true)

Indicate negative match.

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

Indicate negative match.

Parameters
bool$flag
Returns
void
toString ( )

Complete implementation.

Returns
string
toString ( )

Complete implementation.

Returns
string

Member Data Documentation

$_actualCode = null
protected
$_assertType = null
protected
$_assertTypes
protected
Initial value:
= array(
self::ASSERT_RESPONSE_CODE,
self::ASSERT_HEADER,
self::ASSERT_HEADER_CONTAINS,
self::ASSERT_HEADER_REGEX,
)
$_code = 200
protected
$_header = null
protected
$_match = null
protected
$_negate = false
protected
const ASSERT_HEADER = 'assertHeader'
const ASSERT_HEADER_CONTAINS = 'assertHeaderContains'
const ASSERT_HEADER_REGEX = 'assertHeaderRegex'
const ASSERT_RESPONSE_CODE = 'assertResponseCode'

#@+ Assertion type constants