Perforce Chronicle 2012.2/486814
API Documentation

P4Cms_Controller_Request_HttpTestCase Class Reference

More testable version of http requests. More...

List of all members.

Public Member Functions

 getServer ($key=null, $default=null)
 Get one or all server variables.
 setServer ($key, $value)
 Override a server variable for testing purposes.

Protected Attributes

 $_server = array()

Detailed Description

More testable version of http requests.

Allows server variables to be mocked.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

P4Cms_Controller_Request_HttpTestCase::getServer ( key = null,
default = null 
)

Get one or all server variables.

Extended to read from test values first.

Parameters:
string$keyoptional - a specific server variable to get if no $key is passed, returns the entire $_SERVER array
mixed$defaultdefault value to use if key not found
Returns:
mixed Returns null if key does not exist
    {
        if ($key && isset($this->_server[$key])) {
            return $this->_server[$key];
        }

        return parent::getServer($key, $default);
    }
P4Cms_Controller_Request_HttpTestCase::setServer ( key,
value 
)

Override a server variable for testing purposes.

Parameters:
string$keythe name of the variable
mixed$valuethe value of the variable
    {
        $this->_server[$key] = $value;

        return $this;
    }

Member Data Documentation

P4Cms_Controller_Request_HttpTestCase::$_server = array() [protected]

The documentation for this class was generated from the following file: