Response header PHPUnit Constraint

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

 Methods

Constructor; setup constraint state

__construct() : void

Evaluate an object to see if it fits the constraints

evaluate(\Zend_Controller_Response_Abstract $other, $assertType = null) : boolean

Parameters

$other

\Zend_Controller_Response_Abstract

String to examine

$assertType

Returns

boolean

Report Failure

fail(mixed $other, string $description, boolean $not = false) : void
see for implementation details

Parameters

$other

mixed

$description

string

Additional message to display

$not

boolean

Exceptions

\PHPUnit_Framework_ExpectationFailedException

Indicate negative match

setNegate(boolean $flag = true) : void

Parameters

$flag

boolean

Complete implementation

toString() : string

Returns

string

Compare response code for positive match

_code(\Zend_Controller_Response_Abstract $response, integer $code) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$code

integer

Returns

boolean

Retrieve response code

_getCode(\Zend_Controller_Response_Abstract $response) : integer

Parameters

$response

\Zend_Controller_Response_Abstract

Returns

integer

Retrieve response header

_getHeader(\Zend_Controller_Response_Abstract $response, string $header) : string | null

Parameters

$response

\Zend_Controller_Response_Abstract

$header

string

Returns

stringnull

Positive check for response header presence

_header(\Zend_Controller_Response_Abstract $response, string $header) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$header

string

Returns

boolean

Positive check for header contents matching pattern

_headerContains(\Zend_Controller_Response_Abstract $response, string $header, string $match) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$header

string

$match

string

Returns

boolean

Positive check for header contents matching regex

_headerRegex(\Zend_Controller_Response_Abstract $response, string $header, string $pattern) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$header

string

$pattern

string

Returns

boolean

Compare response code for negative match

_notCode(\Zend_Controller_Response_Abstract $response, integer $code) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$code

integer

Returns

boolean

Negative check for response header presence

_notHeader(\Zend_Controller_Response_Abstract $response, string $header) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$header

string

Returns

boolean

Negative check for header contents matching pattern

_notHeaderContains(\Zend_Controller_Response_Abstract $response, string $header, string $match) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$header

string

$match

string

Returns

boolean

Negative check for header contents matching regex

_notHeaderRegex(\Zend_Controller_Response_Abstract $response, string $header, string $pattern) : boolean

Parameters

$response

\Zend_Controller_Response_Abstract

$header

string

$pattern

string

Returns

boolean

 Properties

 

Actual response code

$_actualCode : integer

Default

null
 

Current assertion type

$_assertType : string

Default

null
 

Available assertion types

$_assertTypes : array

Default

array(self::ASSERT_RESPONSE_CODE, self::ASSERT_HEADER, self::ASSERT_HEADER_CONTAINS, self::ASSERT_HEADER_REGEX)
 

Response code

$_code : integer

Default

200
 

Header

$_header : string

Default

null
 

pattern against which to compare header content

$_match : string

Default

null
 

Whether or not assertion is negated

$_negate : boolean

Default

false

 Constants

 

ASSERT_HEADER

ASSERT_HEADER = 'assertHeader' 
 

ASSERT_HEADER_CONTAINS

ASSERT_HEADER_CONTAINS = 'assertHeaderContains' 
 

ASSERT_HEADER_REGEX

ASSERT_HEADER_REGEX = 'assertHeaderRegex' 
 

ASSERT_RESPONSE_CODE

ASSERT_RESPONSE_CODE = 'assertResponseCode'