Browse files

Merge pull request #894 from pixelcog/message-qa

Minor documentation and code cleanup
  • Loading branch information...
2 parents f2ef130 + b752ffd commit c038b4e90d695c6d715a794738c23329cd355db3 @nateabele nateabele committed Apr 19, 2013
View
100 action/Request.php
@@ -50,16 +50,16 @@ class Request extends \lithium\net\http\Request {
public $persist = array();
/**
- * POST data.
+ * Data found in the HTTP request body, most often populated by `$_POST` and `$_FILES`.
*
- * @var data
+ * @var array
*/
public $data = array();
/**
- * GET data.
+ * Key/value pairs found encoded in the request URL after '?', populated by `$_GET`.
*
- * @var string
+ * @var array
*/
public $query = array();
@@ -86,13 +86,6 @@ class Request extends \lithium\net\http\Request {
protected $_env = array();
/**
- * Classes used by `Request`.
- *
- * @var array
- */
- protected $_classes = array('media' => 'lithium\net\http\Media');
-
- /**
* If POST / PUT data is coming from an input stream (rather than `$_POST`), this specified
* where to read it from.
*
@@ -144,37 +137,40 @@ class Request extends \lithium\net\http\Request {
protected $_locale = null;
/**
- * Adds config values to the public properties when a new object is created.
- * Pulling request data from superglobals if `globals` is set to `true`.
+ * Adds config values to the public properties when a new object is created, pulling
+ * request data from superglobals if `globals` is set to `true`.
*
* @param array $config Configuration options : default values are:
- * - `url`: ''
- * - `base`: ''
- * - `data`: array
- * - `scheme`: http
- * - `host`: localhost
- * - `port`: null
- * - `username`: null
- * - `password`: null
- * - `path`: null
- * - `query`: array - after the question mark ?
- * - `headers`: array
- * - `body`: null
- * - `auth` - the Authorization method (Basic|Digest)
- * - `method` - GET
- * - `protocol`: null
- * - `version`: 1.1
- * - `globals` : true. If true build the Request from superglobals.
+ * - `'base'` _string_: null
+ * - `'url'` _string_: null
+ * - `'protocol'` _string_: null
+ * - `'version'` _string_: '1.1'
+ * - `'method'` _string_: 'GET'
+ * - `'scheme'` _string_: 'http'
+ * - `'host'` _string_: 'localhost'
+ * - `'port'` _integer_: null
+ * - `'username'` _string_: null
+ * - `'password'` _string_: null
+ * - `'path'` _string_: null
+ * - `'query'` _array_: array()
+ * - `'headers'` _array_: array()
+ * - `'type'` _string_: null
+ * - `'auth'` _mixed_: null
+ * - `'body'` _mixed_: null
+ * - `'data'` _array_: array()
+ * - `'env'` _array_: array()
+ * - `'globals'` _boolean_: true
*/
public function __construct(array $config = array()) {
- $config += array(
+ $defaults = array(
'base' => null,
'url' => null,
'env' => array(),
'query' => array(),
'data' => array(),
'globals' => true
);
+ $config += $defaults;
if ($config['globals'] === true) {
if (isset($_SERVER)) {
@@ -222,9 +218,8 @@ public function __construct(array $config = array()) {
/**
* Initialize request object
*
- * Defines an artificial `'PLATFORM'` environment variable as either
- * `'IIS'`, `'CGI'` or `null` to allow checking for the SAPI in a
- * normalized way.
+ * Defines an artificial `'PLATFORM'` environment variable as either `'IIS'`, `'CGI'` or `null`
+ * to allow checking for the SAPI in a normalized way.
*/
protected function _init() {
parent::_init();
@@ -400,10 +395,10 @@ public function env($key) {
*
* @see lithium\net\http\Media::negotiate()
* @param $type mixed If not specified, returns the media type name that the client prefers,
- * using content negotiation. If a media type name (string) is passed, returns
- * `true` or `false`, indicating whether or not that type is accepted by the client
- * at all. If `true`, returns the raw content types from the `Accept` header,
- * parsed into an array and sorted by client preference.
+ * using content negotiation. If a media type name (string) is passed, returns `true` or
+ * `false`, indicating whether or not that type is accepted by the client at all.
+ * If `true`, returns the raw content types from the `Accept` header, parsed into an array
+ * and sorted by client preference.
* @return string Returns a simple type name if the type is registered (i.e. `'json'`), or
* a fully-qualified content-type if not (i.e. `'image/jpeg'`), or a boolean or array,
* depending on the value of `$type`.
@@ -522,7 +517,7 @@ public function get($key) {
* @see lithium\action\Request::detect()
* @see lithium\net\http\Media::type()
* @param string $flag The name of the flag to check, which should be the name of a valid
- * detector (that is either built-in or defined with `detect()`).
+ * detector (that is either built-in or defined with `detect()`).
* @return boolean Returns `true` if the detector check succeeds (see the details for the
* built-in detectors above, or `detect()`), otherwise `false`.
*/
@@ -581,19 +576,18 @@ public function type($type = null) {
* {{{ embed:lithium\tests\cases\action\RequestTest::testDetect(11-12) }}}
*
* @see lithium\action\Request::is()
- * @param string $flag The name of the detector check. Used in subsequent calls to
- * `Request::is()`.
+ * @param string $flag The name of the detector check. Used in subsequent calls to `Request::is()`.
* @param mixed $detector Detectors can be specified in four different ways:
- * - The name of an HTTP header or environment variable. If a string, calling the
- * detector will check that the header or environment variable exists and is set
- * to a non-empty value.
- * - A two-element array containing a header/environment variable name, and a value
- * to match against. The second element of the array must be an exact match to
- * the header or variable value.
- * - A two-element array containing a header/environment variable name, and a
- * regular expression that matches against the value, as in the example above.
- * - A closure which accepts an instance of the `Request` object and returns a
- * boolean value.
+ * - The name of an HTTP header or environment variable. If a string, calling the detector
+ * will check that the header or environment variable exists and is set to a non-empty
+ * value.
+ * - A two-element array containing a header/environment variable name, and a value to match
+ * against. The second element of the array must be an exact match to the header or
+ * variable value.
+ * - A two-element array containing a header/environment variable name, and a regular
+ * expression that matches against the value, as in the example above.
+ * - A closure which accepts an instance of the `Request` object and returns a boolean
+ * value.
* @return void
*/
public function detect($flag, $detector = null) {
@@ -652,7 +646,7 @@ public function to($format, array $options = array()) {
* "[Globalization](http://lithify.me/docs/manual/07_globalization)" in the manual.
*
* @param string $locale An optional locale string like `'en'`, `'en_US'` or `'de_DE'`. If
- * specified, will overwrite the existing locale.
+ * specified, will overwrite the existing locale.
* @return Returns the currently set locale string.
*/
public function locale($locale = null) {
@@ -714,7 +708,7 @@ protected function _url($url = null) {
* @return array
*/
protected function _parseFiles() {
- if (isset($_FILES) && $_FILES) {
+ if (!empty($_FILES)) {
$result = array();
$normalize = function($key, $value) use ($result, &$normalize){
View
48 action/Response.php
@@ -28,31 +28,57 @@ class Response extends \lithium\net\http\Response {
*/
protected $_classes = array(
'router' => 'lithium\net\http\Router',
- 'media' => 'lithium\net\http\Media'
+ 'media' => 'lithium\net\http\Media',
+ 'auth' => 'lithium\net\http\Auth'
);
+ /**
+ * Auto configuration properties.
+ *
+ * @var array
+ */
protected $_autoConfig = array('classes' => 'merge');
+ /**
+ * Adds config values to the public properties when a new object is created. Config options
+ * also include default values for `Response::body()` when called from `Response::render()`.
+ *
+ * @see lithium\net\http\Message::body()
+ * @param array $config Configuration options : default value
+ * - `'protocol'` _string_: null
+ * - `'version'` _string_: '1.1'
+ * - `'headers'` _array_: array()
+ * - `'body'` _mixed_: null
+ * - `'message'` _string_: null
+ * - `'status'` _mixed_: null
+ * - `'type'` _string_: null
+ * - `'buffer'` _integer_: null
+ * - `'decode'` _boolean_: null
+ * - `'location'` _mixed_: null
+ * - `'request'` _object_: null
+ */
public function __construct(array $config = array()) {
$defaults = array(
'buffer' => 8192,
'location' => null,
- 'status' => 0,
'request' => null,
'decode' => false
);
parent::__construct($config + $defaults);
}
+ /**
+ * Sets the Location header using `$config['location']` and `$config['request']` passed in
+ * through the constructor if provided.
+ *
+ * @return void
+ */
protected function _init() {
parent::_init();
- $config = $this->_config;
- $this->status($config['status']);
- unset($this->_config['status']);
- if ($config['location']) {
- $classes = $this->_classes;
- $location = $classes['router']::match($config['location'], $config['request']);
+ if ($this->_config['location']) {
+ $router = $this->_classes['router'];
+ $location = $router::match($this->_config['location'], $this->_config['request']);
$this->headers('Location', $location);
}
}
@@ -61,9 +87,9 @@ protected function _init() {
* Controls how or whether the client browser and web proxies should cache this response.
*
* @param mixed $expires This can be a Unix timestamp indicating when the page expires, or a
- * string indicating the relative time offset that a page should expire, i.e.
- * `"+5 hours". Finally, `$expires` can be set to `false` to completely disable
- * browser or proxy caching.
+ * string indicating the relative time offset that a page should expire, i.e. `"+5 hours".
+ * Finally, `$expires` can be set to `false` to completely disable browser or proxy
+ * caching.
* @return void
*/
public function cache($expires) {
View
34 net/Message.php
@@ -41,44 +41,44 @@ class Message extends \lithium\core\Object {
public $port = null;
/**
- * Absolute path of the request.
+ * The username for this endpoint.
*
* @var string
*/
- public $path = null;
+ public $username = null;
/**
- * The username for this endpoint.
+ * The password for this endpoint.
*
* @var string
*/
- public $username = null;
+ public $password = null;
/**
- * The password for this endpoint.
+ * Absolute path of the request.
*
* @var string
*/
- public $password = null;
+ public $path = null;
/**
* The body of the message.
*
- * @var array
+ * @var mixed
*/
- public $body = array();
+ public $body = null;
/**
* Adds config values to the public properties when a new object is created.
*
* @param array $config Configuration options : default value
- * - `scheme`: tcp
- * - `host`: localhost
- * - `port`: null
- * - `username`: null
- * - `password`: null
- * - `path`: null
- * - `body`: null
+ * - `'scheme'` _string_: 'tcp'
+ * - `'host'` _string_: 'localhost'
+ * - `'port'` _integer_: null
+ * - `'username'` _string_: null
+ * - `'password'` _string_: null
+ * - `'path'` _string_: null
+ * - `'body'` _mixed_: null
*/
public function __construct(array $config = array()) {
$defaults = array(
@@ -99,11 +99,11 @@ public function __construct(array $config = array()) {
}
/**
- * Add body parts.
+ * Add body parts and compile the message body.
*
* @param mixed $data
* @param array $options
- * - `'buffer'`: split the body string
+ * - `'buffer'` _integer_: split the body string
* @return array
*/
public function body($data = null, $options = array()) {
View
13 net/http/Auth.php
@@ -9,8 +9,13 @@
namespace lithium\net\http;
/**
- * The `Auth` class handles HTTP Authentication encoding and decode. Typically, this class is not
- * used directly, but is a utility of `action\Request` and `security\auth\adapter\Http`
+ * The `Auth` class handles HTTP Authentication encoding and decoding. Typically, this class is
+ * not used directly, but is a utility of `net\http\Request`, `net\http\Response`, and
+ * `security\auth\adapter\Http`
+ *
+ * @see lithium\net\http\Request::to()
+ * @see lithium\net\http\Response::digest()
+ * @see lithium\security\auth\adapter\Http
*/
class Auth extends \lithium\core\StaticObject {
@@ -30,7 +35,7 @@ public static function header($data) {
if (empty($data['response'])) {
return null;
}
- if (!empty($data['opaque'])) {
+ if (isset($data['nonce'])) {
$defaults = array(
'realm' => 'app', 'method' => 'GET', 'uri' => '/',
'username' => null, 'qop' => 'auth',
@@ -48,7 +53,7 @@ public static function header($data) {
}
/**
- * Encoded the data with username and password to create the proper response. Returns an array
+ * Encodes the data with username and password to create the proper response. Returns an array
* containing the username and encoded response.
*
* @param string $username Username to authenticate with
View
59 net/http/Message.php
@@ -29,7 +29,7 @@ class Message extends \lithium\net\Message {
public $version = '1.1';
/**
- * headers
+ * HTTP headers
*
* @var array
*/
@@ -43,7 +43,7 @@ class Message extends \lithium\net\Message {
protected $_type = null;
/**
- * Classes used by `Request`.
+ * Classes used by `Message` and its subclasses.
*
* @var array
*/
@@ -56,37 +56,32 @@ class Message extends \lithium\net\Message {
* Adds config values to the public properties when a new object is created.
*
* @param array $config Configuration options : default value
- * - `scheme`: http
- * - `host`: localhost
- * - `port`: null
- * - `username`: null
- * - `password`: null
- * - `path`: null
- * - `version`: 1.1
- * - `headers`: array
- * - `body`: null
+ * - `'protocol'` _string_: null
+ * - `'version'` _string_: '1.1'
+ * - `'scheme'` _string_: 'http'
+ * - `'host'` _string_: 'localhost'
+ * - `'port'` _integer_: null
+ * - `'username'` _string_: null
+ * - `'password'` _string_: null
+ * - `'path'` _string_: null
+ * - `'headers'` _array_: array()
+ * - `'body'` _mixed_: null
*/
public function __construct(array $config = array()) {
$defaults = array(
- 'scheme' => 'http',
- 'host' => 'localhost',
- 'port' => null,
- 'username' => null,
- 'password' => null,
- 'path' => null,
- 'query' => array(),
- 'fragment' => null,
'protocol' => null,
'version' => '1.1',
- 'headers' => array(),
- 'body' => null,
- 'auth' => null
+ 'scheme' => 'http',
+ 'host' => 'localhost',
+ 'headers' => array()
);
$config += $defaults;
- parent::__construct($config);
+
foreach (array_intersect_key(array_filter($config), $defaults) as $key => $value) {
$this->{$key} = $value;
}
+ parent::__construct($config);
+
if (strpos($this->host, '/') !== false) {
list($this->host, $this->path) = explode('/', $this->host, 2);
}
@@ -174,11 +169,14 @@ public function type($type = null) {
}
/**
- * Add body parts.
+ * Add data to and compile the HTTP message body, optionally encoding or decoding its parts
+ * according to content type.
*
* @param mixed $data
* @param array $options
- * - `'buffer'`: split the body string
+ * - `'buffer'` _integer_: split the body string
+ * - `'encode'` _boolean_: encode the body based on the content type
+ * - `'decode'` _boolean_: decode the body based on the content type
* @return array
*/
public function body($data = null, $options = array()) {
@@ -201,7 +199,7 @@ public function body($data = null, $options = array()) {
}
/**
- * Encodes the body based on the type
+ * Encode the body based on the content type
*
* @see lithium\net\http\Message::type()
* @param mixed $body
@@ -217,18 +215,19 @@ protected function _encode($body) {
}
/**
- * Decodes the body based on the type
+ * Decode the body based on the content type
*
+ * @see lithium\net\http\Message::type()
* @param string $body
* @return mixed
*/
protected function _decode($body) {
$media = $this->_classes['media'];
- if (!$type = $media::type($this->_type)) {
- return $body;
+ if ($type = $media::type($this->_type)) {
+ return $media::decode($this->_type, $body) ?: $body;
}
- return $media::decode($this->_type, $body) ?: $body;
+ return $body;
}
}
View
117 net/http/Request.php
@@ -17,26 +17,30 @@
class Request extends \lithium\net\http\Message {
/**
- * Key=value pairs after the ?.
+ * The method of the request, typically one of the following: `GET`, `POST`, `PUT`, `DELETE`,
+ * `OPTIONS`, `HEAD`, `TRACE` or `CONNECT`.
*
- * @var array
+ * @var string
*/
- public $query = array();
+ public $method = 'GET';
/**
- * The Authorization type: Basic or Digest
+ * Key/value pairs found encoded in the URL after the '?'.
*
- * @var string
+ * @var array
*/
- public $auth = null;
+ public $query = array();
/**
- * The method of the request, typically one of the following: `GET`, `POST`, `PUT`, `DELETE`,
- * `OPTIONS`, `HEAD`, `TRACE` or `CONNECT`.
+ * Authentication type and parameters for HTTP Basic or Digest.
*
- * @var string
+ * Any array with a 'nonce' attribute implies Digest authentication; all other non-empty values
+ * for imply Basic authentication.
+ *
+ * @see lithium\net\http\Auth::encode()
+ * @var mixed
*/
- public $method;
+ public $auth = null;
/**
* Cookies.
@@ -49,42 +53,40 @@ class Request extends \lithium\net\http\Message {
* Adds config values to the public properties when a new object is created.
*
* @param array $config Configuration options : default value
- * - `scheme`: http
- * - `host`: localhost
- * - `port`: null
- * - `username`: null
- * - `password`: null
- * - `path`: null
- * - `query`: array - after the question mark ?
- * - `fragment`: null - after the hashmark #
- * - `auth` - the Authorization method (Basic|Digest)
- * - `method` - GET
- * - `type`: null
- * - `version`: 1.1
- * - `headers`: array
- * - `body`: null
+ * - `'protocol'` _string_: null
+ * - `'version'` _string_: '1.1'
+ * - `'method'` _string_: 'GET'
+ * - `'scheme'` _string_: 'http'
+ * - `'host'` _string_: 'localhost'
+ * - `'port'` _integer_: null
+ * - `'username'` _string_: null
+ * - `'password'` _string_: null
+ * - `'path'` _string_: null
+ * - `'query'` _array_: array()
+ * - `'headers'` _array_: array()
+ * - `'type'` _string_: null
+ * - `'auth'` _mixed_: null
+ * - `'body'` _mixed_: null
+ * - `'proxy'` _string_: null
+ * - `'ignoreErrors'` _boolean_: true
+ * - `'followLocation'` _boolean_: true
*/
public function __construct(array $config = array()) {
$defaults = array(
- 'scheme' => 'http',
- 'host' => 'localhost',
- 'port' => null,
- 'username' => null,
- 'password' => null,
- 'path' => null,
- 'query' => array(),
- 'fragment' => null,
- 'headers' => array(),
- 'body' => null,
- 'auth' => null,
'method' => 'GET',
+ 'query' => array(),
'type' => null,
+ 'auth' => null,
'proxy' => null,
'ignoreErrors' => true,
'followLocation' => true
);
- parent::__construct($config + $defaults);
- $this->method = $this->method ?: $this->_config['method'];
+ $config += $defaults;
+
+ $this->method = $config['method'];
+ $this->query = $config['query'];
+ $this->auth = $config['auth'];
+ parent::__construct($config);
$this->headers = array(
'Host' => $this->port ? "{$this->host}:{$this->port}" : $this->host,
@@ -98,13 +100,15 @@ public function __construct(array $config = array()) {
}
/**
- * Add body parts and encodes it into formatted string
+ * Compile the HTTP message body, optionally encoding its parts according to content type.
*
- * @see lithium\net\Message::body()
+ * @see lithium\net\http\Message::body()
* @see lithium\net\http\Message::_encode()
* @param mixed $data
* @param array $options
- * - `'buffer'`: split the body string
+ * - `'buffer'` _integer_: split the body string
+ * - `'encode'` _boolean_: encode the body based on the content type
+ * - `'decode'` _boolean_: decode the body based on the content type
* @return array
*/
public function body($data = null, $options = array()) {
@@ -164,24 +168,23 @@ public function queryString($params = array(), $format = null) {
*
* @see lithium\net\Message::to()
* @param string $format Format to convert to. Should be either `'url'`, which returns a string
- * representation of the URL that this request points to, or `'context'`, which
- * returns an array usable with PHP's `stream_context_create()` function. For
- * more available formats, see the parent method, `lithium\net\Message::to()`.
+ * representation of the URL that this request points to, or `'context'`, which returns an
+ * array usable with PHP's `stream_context_create()` function. For more available formats,
+ * see the parent method, `lithium\net\Message::to()`.
* @param array $options Allows overriding of specific portions of the URL, as follows. These
- * options should only be specified if you intend to replace the values that are
- * already in the `Request` object.
- * - `'scheme'` _string_: The protocol scheme of the URL.
- * - `'method'` _string_: If applicable, the HTTP method to use in the request.
- * Mainly applies to the `'context'` format.
- * - `'host'` _string_: The host name the request is pointing at.
- * - `'port'` _string_: The host port, if any.
- * - `'path'` _string_: The URL path.
- * - `'query'` _mixed_: The query string of the URL as a string or array.
- * - `'auth'` _string_: Authentication information. See the constructor for
- * details.
- * - `'content'` _string_: The body of the request.
- * - `'headers'` _array_: The request headers.
- * - `'version'` _string_: The HTTP version of the request, where applicable.
+ * options should only be specified if you intend to replace the values that are already in
+ * the `Request` object.
+ * - `'scheme'` _string_: The protocol scheme of the URL.
+ * - `'method'` _string_: If applicable, the HTTP method to use in the request. Mainly
+ * applies to the `'context'` format.
+ * - `'host'` _string_: The host name the request is pointing at.
+ * - `'port'` _string_: The host port, if any.
+ * - `'path'` _string_: The URL path.
+ * - `'query'` _mixed_: The query string of the URL as a string or array.
+ * - `'auth'` _string_: Authentication information. See the constructor for details.
+ * - `'content'` _string_: The body of the request.
+ * - `'headers'` _array_: The request headers.
+ * - `'version'` _string_: The HTTP version of the request, where applicable.
* @return mixed Varies; see the `$format` parameter for possible return values.
*/
public function to($format, array $options = array()) {
View
29 net/http/Response.php
@@ -85,10 +85,21 @@ class Response extends \lithium\net\http\Message {
/**
* Adds config values to the public properties when a new object is created.
*
- * @param array $config
+ * @param array $config Configuration options : default value
+ * - `'protocol'` _string_: null
+ * - `'version'` _string_: '1.1'
+ * - `'headers'` _array_: array()
+ * - `'body'` _mixed_: null
+ * - `'message'` _string_: null
+ * - `'status'` _mixed_: null
+ * - `'type'` _string_: null
*/
public function __construct(array $config = array()) {
- $defaults = array('message' => null, 'type' => null);
+ $defaults = array(
+ 'message' => null,
+ 'status' => null,
+ 'type' => null
+ );
parent::__construct($config + $defaults);
if ($this->_config['message']) {
@@ -97,6 +108,9 @@ public function __construct(array $config = array()) {
if (isset($this->headers['Transfer-Encoding'])) {
$this->body = $this->_httpChunkedDecode($this->body);
}
+ if ($status = $this->_config['status']) {
+ $this->status($status);
+ }
if ($type = $this->_config['type']) {
$this->type($type);
}
@@ -115,12 +129,16 @@ public function __construct(array $config = array()) {
}
/**
- * Return body parts and decode it into formatted type.
+ * Add data to or compile and return the HTTP message body, optionally decoding its parts
+ * according to content type.
*
* @see lithium\net\Message::body()
* @see lithium\net\http\Message::_decode()
* @param mixed $data
* @param array $options
+ * - `'buffer'` _integer_: split the body string
+ * - `'encode'` _boolean_: encode the body based on the content type
+ * - `'decode'` _boolean_: decode the body based on the content type
* @return array
*/
public function body($data = null, $options = array()) {
@@ -143,7 +161,10 @@ public function status($key = null, $status = null) {
if ($status) {
$this->status = array('code' => null, 'message' => null);
- if (is_numeric($status) && isset($this->_statuses[$status])) {
+ if (is_array($status)) {
+ $key = null;
+ $this->status = $status + $this->status;
+ } elseif (is_numeric($status) && isset($this->_statuses[$status])) {
$this->status = array('code' => $status, 'message' => $this->_statuses[$status]);
} else {
$statuses = array_flip($this->_statuses);
View
2 security/auth/adapter/Http.php
@@ -144,7 +144,7 @@ protected function _digest($request) {
$this->_writeHeader($message);
return false;
}
- return array('username' => $username, 'password' => $password);
+ return compact('username', 'password');
}
/**
View
14 tests/cases/action/RequestTest.php
@@ -906,6 +906,13 @@ public function testDataFromConstructor() {
$expected = array('name' => 'bob');
$result = $request->data;
$this->assertEqual($expected, $result);
+
+ $_POST = array('organization' => 'Union of Rad');
+ $request = new Request(array('data' => array('name' => 'bob')));
+
+ $expected = array('name' => 'bob', 'organization' => 'Union of Rad');
+ $result = $request->data;
+ $this->assertEqual($expected, $result);
}
public function testQueryFromConstructor() {
@@ -914,6 +921,13 @@ public function testQueryFromConstructor() {
$expected = array('page' => 1);
$result = $request->query;
$this->assertEqual($expected, $result);
+
+ $_GET = array('limit' => 10);
+ $request = new Request(array('query' => array('page' => 1)));
+
+ $expected = array('page' => 1, 'limit' => 10);
+ $result = $request->query;
+ $this->assertEqual($expected, $result);
}
public function testMethodOverrideFromData() {

0 comments on commit c038b4e

Please sign in to comment.