Test/PHPUnit/Constraint/ResponseHeader37.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-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Test
- Subpackage
- PHPUnit
- Version
- $Id$
\Zend_Test_PHPUnit_Constraint_ResponseHeader
Package: Zend_Test\PHPUnit
Response header PHPUnit Constraint
- Parent(s)
- \PHPUnit_Framework_Constraint
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Uses
Constants
Properties
array $_assertTypes = array(self::ASSERT_RESPONSE_CODE, self::ASSERT_HEADER, self::ASSERT_HEADER_CONTAINS, self::ASSERT_HEADER_REGEX)
Available assertion types
Default value
array(self::ASSERT_RESPONSE_CODE, self::ASSERT_HEADER, self::ASSERT_HEADER_CONTAINS, self::ASSERT_HEADER_REGEX)
Details- Type
- array
string $_match = null
pattern against which to compare header content
Default value
null
Details- Type
- string
Methods
_code(\Zend_Controller_Response_Abstract $response, int $code) : bool
Compare response code for positive match
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$code | int |
Type | Description |
---|---|
bool |
_getCode(\Zend_Controller_Response_Abstract $response) : int
Retrieve response code
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract |
Type | Description |
---|---|
int |
_getHeader(\Zend_Controller_Response_Abstract $response, string $header) : string | null
Retrieve response header
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$header | string |
Type | Description |
---|---|
string | null |
_header(\Zend_Controller_Response_Abstract $response, string $header) : bool
Positive check for response header presence
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$header | string |
Type | Description |
---|---|
bool |
_headerContains(\Zend_Controller_Response_Abstract $response, string $header, string $match) : bool
Positive check for header contents matching pattern
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$header | string | |
$match | string |
Type | Description |
---|---|
bool |
_headerRegex(\Zend_Controller_Response_Abstract $response, string $header, string $pattern) : bool
Positive check for header contents matching regex
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$header | string | |
$pattern | string |
Type | Description |
---|---|
bool |
_notCode(\Zend_Controller_Response_Abstract $response, int $code) : bool
Compare response code for negative match
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$code | int |
Type | Description |
---|---|
bool |
_notHeader(\Zend_Controller_Response_Abstract $response, string $header) : bool
Negative check for response header presence
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$header | string |
Type | Description |
---|---|
bool |
_notHeaderContains(\Zend_Controller_Response_Abstract $response, string $header, string $match) : bool
Negative check for header contents matching pattern
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$header | string | |
$match | string |
Type | Description |
---|---|
bool |
_notHeaderRegex(\Zend_Controller_Response_Abstract $response, string $header, string $pattern) : bool
Negative check for header contents matching regex
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | \Zend_Controller_Response_Abstract | |
$header | string | |
$pattern | string |
Type | Description |
---|---|
bool |
evaluate( $response, $assertType = '', $variable = FALSE) : bool
Evaluate an object to see if it fits the constraints
Parameters
Returns
Name | Type | Description |
---|---|---|
$response | ||
$assertType | ||
$variable |
Type | Description |
---|---|
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, $cannot_be_used = NULL) : void
Report Failure
Parameters
Throws
Details
Name | Type | Description |
---|---|---|
$other | ||
$description | ||
$cannot_be_used |
Exception | Description |
---|---|
\PHPUnit_Framework_ExpectationFailedException | NOTE: 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 |