Controller/Response/HttpTestCase.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 [email protected] 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_Controller  
Version
$Id: HttpTestCase.php 24593 2012-01-05 20:35:02Z matthew $  

\Zend_Controller_Response_HttpTestCase

Package: Zend\Controller\Response

Zend_Controller_Response_HttpTestCase

HTTP response for controllers

Parent(s)
\Zend_Controller_Response_Http < \Zend_Controller_Response_Abstract
Copyright
Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)  
Uses
\global\Zend_Controller_Response_Http  

Properties

Propertyprotectedarray $_body = array()
Default valuearray()Details
Type
array
Inherited_from
\Zend_Controller_Response_Abstract::$$_body  
Inherited_from
\Zend_Controller_Response_Http::$$_body  
Propertyprotected\Exception $_exceptions = array()
Default valuearray()Details
Type
\Exception
Inherited_from
\Zend_Controller_Response_Abstract::$$_exceptions  
Inherited_from
\Zend_Controller_Response_Http::$$_exceptions  
Propertyprotectedarray $_headers = array()

Each header is an array with keys 'name' and 'value'

Default valuearray()Details
Type
array
Inherited_from
\Zend_Controller_Response_Abstract::$$_headers  
Inherited_from
\Zend_Controller_Response_Http::$$_headers  
Propertyprotectedarray $_headersRaw = array()

Each header is a single string, the entire header to emit

Default valuearray()Details
Type
array
Inherited_from
\Zend_Controller_Response_Abstract::$$_headersRaw  
Inherited_from
\Zend_Controller_Response_Http::$$_headersRaw  
Propertyprotectedint $_httpResponseCode = 200
Default value200Details
Type
int
Inherited_from
\Zend_Controller_Response_Abstract::$$_httpResponseCode  
Inherited_from
\Zend_Controller_Response_Http::$$_httpResponseCode  
Propertyprotectedboolean $_isRedirect = false
Default valuefalseDetails
Type
boolean
Inherited_from
\Zend_Controller_Response_Abstract::$$_isRedirect  
Inherited_from
\Zend_Controller_Response_Http::$$_isRedirect  
Propertyprotectedboolean $_renderExceptions = false
inherited

Whether or not to render exceptions; off by default

Inherited from: \Zend_Controller_Response_Abstract::$$_renderExceptions\Zend_Controller_Response_Http::$$_renderExceptions
Default valuefalseDetails
Type
boolean
Inherited_from
\Zend_Controller_Response_Abstract::$$_renderExceptions  
Inherited_from
\Zend_Controller_Response_Http::$$_renderExceptions  
Propertypublicboolean $headersSentThrowsException = true
inherited

Flag; if true, when header operations are called after headers have been sent, an exception will be raised; otherwise, processing will continue as normal.

Inherited from: \Zend_Controller_Response_Abstract::$$headersSentThrowsException\Zend_Controller_Response_Http::$$headersSentThrowsException

Defaults to true.

Default valuetrueDetails
Type
boolean
Inherited_from
\Zend_Controller_Response_Abstract::$$headersSentThrowsException  
Inherited_from
\Zend_Controller_Response_Http::$$headersSentThrowsException  
See
\global\canSendHeaders()  

Methods

methodpublic__toString() : string

Proxies to sendResponse() and returns response value as string using output buffering.

Returns
Type Description
string
methodprotected_normalizeHeader(string $name) : string

Normalizes a header name to X-Capitalized-Names

Parameters
Name Type Description
$name string
Returns
Type Description
string
methodpublicappend(string $name, string $content) : \Zend_Controller_Response_Abstract
inherited

Append a named body segment to the body content array

Inherited from: \Zend_Controller_Response_Abstract::append()\Zend_Controller_Response_Http::append()

If segment already exists, replaces with $content and places at end of array.

Parameters
Name Type Description
$name string
$content string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicappendBody(string $content, null | string $name = null) : \Zend_Controller_Response_Abstract
inherited

Append content to the body content

Inherited from: \Zend_Controller_Response_Abstract::appendBody()\Zend_Controller_Response_Http::appendBody()
Parameters
Name Type Description
$content string
$name null | string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpubliccanSendHeaders(bool $throw = false) : void

Can we send headers?

Parameters
Name Type Description
$throw bool
Throws
Exception Description
\Zend_Controller_Response_Exception
methodpublicclearBody(string $name = null) : boolean

With no arguments, clears the entire body array. Given a $name, clears just that named segment; if no segment matching $name exists, returns false to indicate an error.

Parameters
Name Type Description
$name string

Named segment to clear

Returns
Type Description
boolean
methodpublicclearHeader(string $name) : \Zend_Controller_Response_Abstract
Parameters
Name Type Description
$name string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicclearRawHeader(string $headerRaw) : \Zend_Controller_Response_Abstract
Parameters
Name Type Description
$headerRaw string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicclearRawHeaders() : \Zend_Controller_Response_Abstract
inherited

Clear all {@link setRawHeader() raw HTTP headers}

Inherited from: \Zend_Controller_Response_Abstract::clearRawHeaders()\Zend_Controller_Response_Http::clearRawHeaders()
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicgetBody(bool | string $spec = false) : string | array | null

Get body and/or body segments

If $spec is false, returns the concatenated values of the body content array. If $spec is boolean true, returns the body content array. If $spec is a string and matches a named segment, returns the contents of that segment; otherwise, returns null.

Parameters
Name Type Description
$spec bool | string
Returns
Type Description
string | array | null
methodpublicgetException() : array
Returns
Type Description
array
methodpublicgetExceptionByCode(mixed $code) : void
Parameters
Name Type Description
$code mixed
methodpublicgetExceptionByMessage(string $message) : false | array
Parameters
Name Type Description
$message string
Returns
Type Description
false | array
methodpublicgetExceptionByType(string $type) : false | array
Parameters
Name Type Description
$type string
Returns
Type Description
false | array
methodpublicgetHeaders() : array
inherited

Return array of headers; see {@link $_headers} for format

Inherited from: \Zend_Controller_Response_Abstract::getHeaders()\Zend_Controller_Response_Http::getHeaders()
Returns
Type Description
array
methodpublicgetHttpResponseCode() : int
Returns
Type Description
int
methodpublicgetRawHeaders() : array
inherited

Retrieve all {@link setRawHeader() raw HTTP headers}

Inherited from: \Zend_Controller_Response_Abstract::getRawHeaders()\Zend_Controller_Response_Http::getRawHeaders()
Returns
Type Description
array
methodpublichasExceptionOfCode(int $code) : boolean
inherited

Does the response object contain an exception with a given code?

Inherited from: \Zend_Controller_Response_Abstract::hasExceptionOfCode()\Zend_Controller_Response_Http::hasExceptionOfCode()
Parameters
Name Type Description
$code int
Returns
Type Description
boolean
methodpublichasExceptionOfMessage(string $message) : boolean
inherited

Does the response object contain an exception with a given message?

Inherited from: \Zend_Controller_Response_Abstract::hasExceptionOfMessage()\Zend_Controller_Response_Http::hasExceptionOfMessage()
Parameters
Name Type Description
$message string
Returns
Type Description
boolean
methodpublichasExceptionOfType(string $type) : boolean
inherited

Does the response object contain an exception of a given type?

Inherited from: \Zend_Controller_Response_Abstract::hasExceptionOfType()\Zend_Controller_Response_Http::hasExceptionOfType()
Parameters
Name Type Description
$type string
Returns
Type Description
boolean
methodpublicinsert(string $name, string $content, string $parent = null, boolean $before = false) : \Zend_Controller_Response_Abstract
inherited

Insert a named segment into the body content array

Inherited from: \Zend_Controller_Response_Abstract::insert()\Zend_Controller_Response_Http::insert()
Parameters
Name Type Description
$name string
$content string
$parent string
$before boolean

Whether to insert the new segment before or after the parent. Defaults to false (after)

Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicisException() : boolean
inherited

Has an exception been registered with the response?

Inherited from: \Zend_Controller_Response_Abstract::isException()\Zend_Controller_Response_Http::isException()
Returns
Type Description
boolean
methodpublicisRedirect() : boolean
Returns
Type Description
boolean
methodpublicoutputBody() : string

Return the concatenated body segments

Returns
Type Description
string
methodpublicprepend(string $name, string $content) : void
inherited

Prepend a named body segment to the body content array

Inherited from: \Zend_Controller_Response_Abstract::prepend()\Zend_Controller_Response_Http::prepend()

If segment already exists, replaces with $content and places at top of array.

Parameters
Name Type Description
$name string
$content string
methodpublicrenderExceptions(boolean $flag = null) : boolean
inherited

Whether or not to render exceptions (off by default)

Inherited from: \Zend_Controller_Response_Abstract::renderExceptions()\Zend_Controller_Response_Http::renderExceptions()

If called with no arguments or a null argument, returns the value of the flag; otherwise, sets it and returns the current value.

Parameters
Name Type Description
$flag boolean

Optional

Returns
Type Description
boolean
methodpublicsendHeaders() : array

"send" headers by returning array of all headers that would be sent

Sends any headers specified. If an HTTP response code has been specified, it is sent with the first header.

Returns
Type Description
array
methodpublicsendResponse() : string

"send" Response

Concats all response headers, and then final body (separated by two newlines)

Returns
Type Description
string
methodpublicsetBody(string $content, null | string $name = null) : \Zend_Controller_Response_Abstract

If $name is not passed, or is not a string, resets the entire body and sets the 'default' key to $content.

If $name is a string, sets the named segment in the body array to $content.

Parameters
Name Type Description
$content string
$name null | string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetException(\Exception $e) : \Zend_Controller_Response_Abstract
inherited

Register an exception with the response

Inherited from: \Zend_Controller_Response_Abstract::setException()\Zend_Controller_Response_Http::setException()
Parameters
Name Type Description
$e \Exception
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetHeader(string $name, string $value, boolean $replace = false) : \Zend_Controller_Response_Abstract

If $replace is true, replaces any headers already defined with that $name.

Parameters
Name Type Description
$name string
$value string
$replace boolean
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetHttpResponseCode(int $code) : \Zend_Controller_Response_Abstract
Parameters
Name Type Description
$code int
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetRawHeader(string $value) : \Zend_Controller_Response_Abstract

Allows setting non key => value headers, such as status codes

Parameters
Name Type Description
$value string
Returns
Type Description
\Zend_Controller_Response_Abstract
methodpublicsetRedirect(string $url, int $code = 302) : \Zend_Controller_Response_Abstract

Sets Location header and response code. Forces replacement of any prior redirects.

Parameters
Name Type Description
$url string
$code int
Returns
Type Description
\Zend_Controller_Response_Abstract
Documentation was generated by phpDocumentor 2.0.0a8.