API Documentation

Zend/Test/PHPUnit/Constraint/ResponseHeader.php

Show: inherited
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 license@zend.com so we can send you a copy immediately.

Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Test  
Subpackage
PHPUnit  
Version
$Id: ResponseHeader.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Test_PHPUnit_Constraint_ResponseHeader

Package: Zend\Test\PHPUnit

Response header PHPUnit Constraint

Parent(s)
\PHPUnit_Framework_Constraint
Category
Zend  
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Uses
\PHPUnit_Framework_Constraint  

Constants

Constant  ASSERT_RESPONSE_CODE = 'assertResponseCode'
Constant  ASSERT_HEADER = 'assertHeader'
Constant  ASSERT_HEADER_CONTAINS = 'assertHeaderContains'
Constant  ASSERT_HEADER_REGEX = 'assertHeaderRegex'

Properties

Propertyprotectedstring  $_assertType= 'null'

Current assertion type

Default valuenullDetails
Type
string
Propertyprotectedarray  $_assertTypes= 'array( self::ASSERT_RESPONSE_CODE'

Available assertion types

Default valuearray( self::ASSERT_RESPONSE_CODEDetails
Type
array
Propertyprotectedint  $_code= '200'

Response code
Default value200Details
Type
int
Propertyprotectedstring  $_header= 'null'

Header
Default valuenullDetails
Type
string
Propertyprotectedstring  $_match= 'null'

pattern against which to compare header content
Default valuenullDetails
Type
string
Propertyprotectedbool  $_negate= 'false'

Whether or not assertion is negated

Default valuefalseDetails
Type
bool

Methods

methodpublic__construct( ) : void

Constructor; setup constraint state

methodprotected_code( \Zend_Controller_Response_Abstract $response, int $code ) : bool

Compare response code for positive match

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$code int
Returns
Type Description
bool
methodprotected_getCode( \Zend_Controller_Response_Abstract $response ) : int

Retrieve response code

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
Returns
Type Description
int
methodprotected_getHeader( \Zend_Controller_Response_Abstract $response, string $header ) : string|null

Retrieve response header

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$header string
Returns
Type Description
string|null
methodprotected_header( \Zend_Controller_Response_Abstract $response, string $header ) : bool

Positive check for response header presence

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$header string
Returns
Type Description
bool
methodprotected_headerContains( \Zend_Controller_Response_Abstract $response, string $header, string $match ) : bool

Positive check for header contents matching pattern

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$header string
$match string
Returns
Type Description
bool
methodprotected_headerRegex( \Zend_Controller_Response_Abstract $response, string $header, string $pattern ) : bool

Positive check for header contents matching regex

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$header string
$pattern string
Returns
Type Description
bool
methodprotected_notCode( \Zend_Controller_Response_Abstract $response, int $code ) : bool

Compare response code for negative match

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$code int
Returns
Type Description
bool
methodprotected_notHeader( \Zend_Controller_Response_Abstract $response, string $header ) : bool

Negative check for response header presence

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$header string
Returns
Type Description
bool
methodprotected_notHeaderContains( \Zend_Controller_Response_Abstract $response, string $header, string $match ) : bool

Negative check for header contents matching pattern

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$header string
$match string
Returns
Type Description
bool
methodprotected_notHeaderRegex( \Zend_Controller_Response_Abstract $response, string $header, string $pattern ) : bool

Negative check for header contents matching regex

Parameters
Name Type Description
$response \Zend_Controller_Response_Abstract
$header string
$pattern string
Returns
Type Description
bool
methodpublicevaluate( \Zend_Controller_Response_Abstract $other, null|string $assertType = null ) : bool

Evaluate an object to see if it fits the constraints

Parameters
Name Type Description
$other \Zend_Controller_Response_Abstract

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
$description string

Additional message to display

$not bool
Throws
Exception Description
\PHPUnit_Framework_ExpectationFailedException
Details
See
\PHPUnit_Framework_Constraint  
methodpublicsetNegate( bool $flag = true ) : void

Indicate negative match

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

Complete implementation

Returns
Type Description
string
Documentation was generated by DocBlox 0.15.1.