Controller/Request/HttpTestCase.php
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_Controller
- Version
- $Id: HttpTestCase.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Controller_Request_HttpTestCase
HTTP request object for use with Zend_Controller family.
- Parent(s)
- \Zend_Controller_Request_Http < \Zend_Controller_Request_Abstract
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- Uses
- \global\Zend_Controller_Request_Http
Constants
Properties


string $_action
- Type
- string
- Inherited_from
- \Zend_Controller_Request_Abstract::$$_action
- Inherited_from
- \Zend_Controller_Request_Http::$$_action


string $_actionKey = 'action'
'action'
Details- Type
- string
- Inherited_from
- \Zend_Controller_Request_Abstract::$$_actionKey
- Inherited_from
- \Zend_Controller_Request_Http::$$_actionKey


array $_aliases = array()
array()
Details- Type
- array
- Inherited_from
- \Zend_Controller_Request_Http::$$_aliases


string $_basePath = null
null
Details- Type
- string
- Inherited_from
- \Zend_Controller_Request_Http::$$_basePath


string $_baseUrl = null
null
Details- Type
- string
- Inherited_from
- \Zend_Controller_Request_Http::$$_baseUrl


string $_controller
- Type
- string
- Inherited_from
- \Zend_Controller_Request_Abstract::$$_controller
- Inherited_from
- \Zend_Controller_Request_Http::$$_controller


string $_controllerKey = 'controller'
'controller'
Details- Type
- string
- Inherited_from
- \Zend_Controller_Request_Abstract::$$_controllerKey
- Inherited_from
- \Zend_Controller_Request_Http::$$_controllerKey


boolean $_dispatched = false
false
Details- Type
- boolean
- Inherited_from
- \Zend_Controller_Request_Abstract::$$_dispatched
- Inherited_from
- \Zend_Controller_Request_Http::$$_dispatched


string $_module
- Type
- string
- Inherited_from
- \Zend_Controller_Request_Abstract::$$_module
- Inherited_from
- \Zend_Controller_Request_Http::$$_module


string $_moduleKey = 'module'
'module'
Details- Type
- string
- Inherited_from
- \Zend_Controller_Request_Abstract::$$_moduleKey
- Inherited_from
- \Zend_Controller_Request_Http::$$_moduleKey


array $_paramSources = array('_GET', '_POST')
array('_GET', '_POST')
Details- Type
- array
- Inherited_from
- \Zend_Controller_Request_Http::$$_paramSources


array $_params = array()
array()
Details- Type
- array
- Inherited_from
- \Zend_Controller_Request_Http::$$_params


string $_pathInfo = ''
''
Details- Type
- string
- Inherited_from
- \Zend_Controller_Request_Http::$$_pathInfo
Methods


__construct(string | \Zend_Uri $uri = null) : void
If a $uri is passed, the object will attempt to populate itself using that information.
Name | Type | Description |
---|---|---|
$uri | string | \Zend_Uri |
Exception | Description |
---|---|
\Zend_Controller_Request_Exception | when invalid URI passed |


__get(string $key) : mixed
Access values contained in the superglobals as public members Order of precedence: 1.
Inherited from: \Zend_Controller_Request_Http::__get()GET, 2. POST, 3. COOKIE, 4. SERVER, 5. ENV
Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
mixed |
- See
- \http://msdn.microsoft.com/en-us/library/system.web.httprequest.item.aspx


__set(string $key, mixed $value) : void
In order to follow __get(), which operates on a number of superglobals, setting values through overloading is not allowed and will raise an exception. Use setParam() instead.
Name | Type | Description |
---|---|---|
$key | string | |
$value | mixed |
Exception | Description |
---|---|
\Zend_Controller_Request_Exception |


_normalizeHeaderName(string $name) : string
Normalize a header name for setting and retrieval
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
string |


clearCookies() : \Zend_Controller_Request_HttpTestCase
Clear all cookies
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


clearHeaders() : \Zend_Controller_Request_HttpTestCase
Clear request headers
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


clearParams() : \Zend_Controller_Request_Abstract
Unset all user parameters
Inherited from: \Zend_Controller_Request_Abstract::clearParams()\Zend_Controller_Request_Http::clearParams()Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


clearPost() : \Zend_Controller_Request_HttpTestCase
Clear POST values
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


clearQuery() : \Zend_Controller_Request_HttpTestCase
Clear GET values
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


clearRawBody() : \Zend_Controller_Request_HttpTestCase
Clear raw POST body
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


getActionKey() : string
Retrieve the action key
Inherited from: \Zend_Controller_Request_Abstract::getActionKey()\Zend_Controller_Request_Http::getActionKey()Type | Description |
---|---|
string |


getActionName() : string
Retrieve the action name
Inherited from: \Zend_Controller_Request_Abstract::getActionName()\Zend_Controller_Request_Http::getActionName()Type | Description |
---|---|
string |


getAlias(string $name) : string | null
Retrieve the actual key represented by the alias $name.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
string | null | Returns null when no alias exists |


getAliases() : array
Retrieve the list of all aliases
Inherited from: \Zend_Controller_Request_Http::getAliases()Type | Description |
---|---|
array |


getBasePath() : string
Everything in REQUEST_URI before PATH_INFO not including the filename
Type | Description |
---|---|
string |


getBaseUrl( $raw = false) : string
Everything in REQUEST_URI before PATH_INFO
Inherited from: \Zend_Controller_Request_Http::getBaseUrl()Name | Type | Description |
---|---|---|
$raw |
Type | Description |
---|---|
string |


getClientIp(boolean $checkProxy = true) : string
Name | Type | Description |
---|---|---|
$checkProxy | boolean |
Type | Description |
---|---|
string |


getControllerKey() : string
Retrieve the controller key
Inherited from: \Zend_Controller_Request_Abstract::getControllerKey()\Zend_Controller_Request_Http::getControllerKey()Type | Description |
---|---|
string |


getControllerName() : string
Retrieve the controller name
Inherited from: \Zend_Controller_Request_Abstract::getControllerName()\Zend_Controller_Request_Http::getControllerName()Type | Description |
---|---|
string |


getCookie(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_COOKIE superglobal
Inherited from: \Zend_Controller_Request_Http::getCookie()If no $key is passed, returns the entire $_COOKIE array.
Name | Type | Description |
---|---|---|
$key | string | |
$default | mixed | Default value to use if key not found |
Type | Description |
---|---|
mixed | Returns null if key does not exist |


getEnv(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_ENV superglobal
Inherited from: \Zend_Controller_Request_Http::getEnv()If no $key is passed, returns the entire $_ENV array.
Name | Type | Description |
---|---|---|
$key | string | |
$default | mixed | Default value to use if key not found |
Type | Description |
---|---|
mixed | Returns null if key does not exist |


getHeader(string $header, mixed $default = null) : string | null
Get request header
Pass the header name as the plain, HTTP-specified header name. Ex.: Ask for 'Accept' to get the Accept header, 'Accept-Encoding' to get the Accept-Encoding header.
Name | Type | Description |
---|---|---|
$header | string | |
$default | mixed |
Type | Description |
---|---|
string | null |
Exception | Description |
---|---|
\Zend_Controller_Request_Exception |


getHttpHost() : string
"Host" ":" host [ ":" port ] ; Section 3.2.2 Note the HTTP Host header is not the same as the URI host. It includes the port while the URI host doesn't.
Type | Description |
---|---|
string |


getModuleKey() : string
Retrieve the module key
Inherited from: \Zend_Controller_Request_Abstract::getModuleKey()\Zend_Controller_Request_Http::getModuleKey()Type | Description |
---|---|
string |


getModuleName() : string
Retrieve the module name
Inherited from: \Zend_Controller_Request_Abstract::getModuleName()\Zend_Controller_Request_Http::getModuleName()Type | Description |
---|---|
string |


getParam(mixed $key, mixed $default = null) : mixed
Retrieves a parameter from the instance. Priority is in the order of userland parameters (see setParam()), $_GET, $_POST. If a parameter matching the $key is not found, null is returned.
If the $key is an alias, the actual key aliased will be used.
Name | Type | Description |
---|---|---|
$key | mixed | |
$default | mixed | Default value to use if key not found |
Type | Description |
---|---|
mixed |


getParamSources() : array
Get list of allowed parameter sources
Inherited from: \Zend_Controller_Request_Http::getParamSources()Type | Description |
---|---|
array |


getParams() : array
Retrieves a merged array of parameters, with precedence of userland params (see setParam()), $_GET, $_POST (i.e., values in the userland params will take precedence over all others).
Type | Description |
---|---|
array |


getPathInfo() : string
Returns everything between the BaseUrl and QueryString.
Inherited from: \Zend_Controller_Request_Http::getPathInfo()This value is calculated instead of reading PATH_INFO directly from $_SERVER due to cross-platform differences.
Type | Description |
---|---|
string |


getPost(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_POST superglobal
Inherited from: \Zend_Controller_Request_Http::getPost()If no $key is passed, returns the entire $_POST array.
Name | Type | Description |
---|---|---|
$key | string | |
$default | mixed | Default value to use if key not found |
Type | Description |
---|---|
mixed | Returns null if key does not exist |


getQuery(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_GET superglobal
Inherited from: \Zend_Controller_Request_Http::getQuery()If no $key is passed, returns the entire $_GET array.
Name | Type | Description |
---|---|---|
$key | string | |
$default | mixed | Default value to use if key not found |
Type | Description |
---|---|
mixed | Returns null if key does not exist |


getServer(string $key = null, mixed $default = null) : mixed
Retrieve a member of the $_SERVER superglobal
Inherited from: \Zend_Controller_Request_Http::getServer()If no $key is passed, returns the entire $_SERVER array.
Name | Type | Description |
---|---|---|
$key | string | |
$default | mixed | Default value to use if key not found |
Type | Description |
---|---|
mixed | Returns null if key does not exist |


getUserParam(string $key, string $default = null) : mixed
Retrieve a single user param (i.e, a param specific to the object and not the environment)
Inherited from: \Zend_Controller_Request_Abstract::getUserParam()\Zend_Controller_Request_Http::getUserParam()Name | Type | Description |
---|---|---|
$key | string | |
$default | string | Default value to use if key not found |
Type | Description |
---|---|
mixed |


getUserParams() : array
Retrieve only user params (i.e, any param specific to the object and not the environment)
Inherited from: \Zend_Controller_Request_Abstract::getUserParams()\Zend_Controller_Request_Http::getUserParams()Type | Description |
---|---|
array |


isDispatched() : boolean
Determine if the request has been dispatched
Inherited from: \Zend_Controller_Request_Abstract::isDispatched()\Zend_Controller_Request_Http::isDispatched()Type | Description |
---|---|
boolean |


isXmlHttpRequest() : boolean
Is the request a Javascript XMLHttpRequest?
Inherited from: \Zend_Controller_Request_Http::isXmlHttpRequest()Should work with Prototype/Script.aculo.us, possibly others.
Type | Description |
---|---|
boolean |


setActionKey(string $key) : \Zend_Controller_Request_Abstract
Set the action key
Inherited from: \Zend_Controller_Request_Abstract::setActionKey()\Zend_Controller_Request_Http::setActionKey()Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


setActionName(string $value) : \Zend_Controller_Request_Abstract
Set the action name
Inherited from: \Zend_Controller_Request_Abstract::setActionName()\Zend_Controller_Request_Http::setActionName()Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


setAlias(string $name, string $target) : \Zend_Controller_Request_Http
Set an alias used for key lookups. $name specifies the alias, $target specifies the actual key to use.
Name | Type | Description |
---|---|---|
$name | string | |
$target | string |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setBasePath(string | null $basePath = null) : \Zend_Controller_Request_Http
Name | Type | Description |
---|---|---|
$basePath | string | null |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setBaseUrl(mixed $baseUrl = null) : \Zend_Controller_Request_Http
Set the base URL of the request; i.e., the segment leading to the script name
Inherited from: \Zend_Controller_Request_Http::setBaseUrl()E.g.: - /admin - /myapp - /subdir/index.php
Do not use the full URI when providing the base. The following are examples of what not to use: - http://example.com/admin (should be just /admin) - http://example.com/subdir/index.php (should be just /subdir/index.php)
If no $baseUrl is provided, attempts to determine the base URL from the environment, using SCRIPT_FILENAME, SCRIPT_NAME, PHP_SELF, and ORIG_SCRIPT_NAME in its determination.
Name | Type | Description |
---|---|---|
$baseUrl | mixed |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setControllerKey(string $key) : \Zend_Controller_Request_Abstract
Set the controller key
Inherited from: \Zend_Controller_Request_Abstract::setControllerKey()\Zend_Controller_Request_Http::setControllerKey()Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


setControllerName(string $value) : \Zend_Controller_Request_Abstract
Set the controller name to use
Inherited from: \Zend_Controller_Request_Abstract::setControllerName()\Zend_Controller_Request_Http::setControllerName()Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


setCookie(string $key, mixed $value) : \Zend_Controller_Request_HttpTestCase
Set a cookie
Name | Type | Description |
---|---|---|
$key | string | |
$value | mixed |
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


setCookies(array $cookies) : void
Set multiple cookies at once
Name | Type | Description |
---|---|---|
$cookies | array |


setDispatched(boolean $flag = true) : \Zend_Controller_Request_Abstract
Set flag indicating whether or not request has been dispatched
Inherited from: \Zend_Controller_Request_Abstract::setDispatched()\Zend_Controller_Request_Http::setDispatched()Name | Type | Description |
---|---|---|
$flag | boolean |
Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


setHeader(string $key, string $value) : \Zend_Controller_Request_HttpTestCase
Set a request header
Name | Type | Description |
---|---|---|
$key | string | |
$value | string |
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


setHeaders(array $headers) : \Zend_Controller_Request_HttpTestCase
Set request headers
Name | Type | Description |
---|---|---|
$headers | array |
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


setMethod(string $type) : \Zend_Controller_Request_HttpTestCase
Set request method
Name | Type | Description |
---|---|---|
$type | string |
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


setModuleKey(string $key) : \Zend_Controller_Request_Abstract
Set the module key
Inherited from: \Zend_Controller_Request_Abstract::setModuleKey()\Zend_Controller_Request_Http::setModuleKey()Name | Type | Description |
---|---|---|
$key | string |
Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


setModuleName(string $value) : \Zend_Controller_Request_Abstract
Set the module name to use
Inherited from: \Zend_Controller_Request_Abstract::setModuleName()\Zend_Controller_Request_Http::setModuleName()Name | Type | Description |
---|---|---|
$value | string |
Type | Description |
---|---|
\Zend_Controller_Request_Abstract |


setParam(mixed $key, mixed $value) : \Zend_Controller_Request_Http
Uses $key to set a userland parameter. If $key is an alias, the actual key will be retrieved and used to set the parameter.
Name | Type | Description |
---|---|---|
$key | mixed | |
$value | mixed |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setParamSources( $paramSources = array()) : \Zend_Controller_Request_Http
Set allowed parameter sources
Inherited from: \Zend_Controller_Request_Http::setParamSources()Can be empty array, or contain one or more of '_GET' or '_POST'.
Name | Type | Description |
---|---|---|
$paramSources |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setParams(array $params) : \Zend_Controller_Request_Http
Set one or more parameters. Parameters are set as userland parameters, using the keys specified in the array.
Name | Type | Description |
---|---|---|
$params | array |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setPathInfo(string | null $pathInfo = null) : \Zend_Controller_Request_Http
Name | Type | Description |
---|---|---|
$pathInfo | string | null |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setPost(string | array $spec, null | mixed $value = null) : \Zend_Controller_Request_Http
Name | Type | Description |
---|---|---|
$spec | string | array | |
$value | null | mixed |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setQuery(string | array $spec, null | mixed $value = null) : \Zend_Controller_Request_Http
Name | Type | Description |
---|---|---|
$spec | string | array | |
$value | null | mixed |
Type | Description |
---|---|
\Zend_Controller_Request_Http |


setRawBody(string $content) : \Zend_Controller_Request_HttpTestCase
Set raw POST body
Name | Type | Description |
---|---|---|
$content | string |
Type | Description |
---|---|
\Zend_Controller_Request_HttpTestCase |


setRequestUri(string $requestUri = null) : \Zend_Controller_Request_Http
Set the REQUEST_URI on which the instance operates
Inherited from: \Zend_Controller_Request_Http::setRequestUri()If no request URI is passed, uses the value in $_SERVER['REQUEST_URI'], $_SERVER['HTTP_X_REWRITE_URL'], or $_SERVER['ORIG_PATH_INFO'] + $_SERVER['QUERY_STRING'].
Name | Type | Description |
---|---|---|
$requestUri | string |
Type | Description |
---|---|
\Zend_Controller_Request_Http |