Moving query string params around. Updating test cases.

This commit is contained in:
Mark Story 2010-04-29 23:20:31 -04:00
parent 0bbd7fae2c
commit 51db3c80ef
2 changed files with 24 additions and 5 deletions

View file

@ -42,7 +42,14 @@ class CakeRequest implements ArrayAccess {
*
* @var array
*/
public $url = array();
public $query = array();
/**
* The url string used for the request.
*
* @var string
*/
public $url;
/**
* The built in detectors used with `is()` can be modified with `addDetector()`.
@ -122,9 +129,11 @@ class CakeRequest implements ArrayAccess {
$url = $_GET;
}
if (isset($this->params['url'])) {
$this->url = array_merge($this->url, $url);
} else {
$this->url = $url;
$url = array_merge($this->params['url'], $url);
}
$this->query = $url;
if (isset($this->query['url'])) {
$this->url = $this->query['url'];
}
}

View file

@ -38,7 +38,17 @@ class CakeRequestTestCase extends CakeTestCase {
'two' => 'banana'
);
$request = new CakeRequest();
$this->assertEqual($request->url, $_GET);
$this->assertEqual($request->query, $_GET);
$_GET = array(
'one' => 'param',
'two' => 'banana',
'url' => '/some/path/here'
);
$request = new CakeRequest();
$this->assertEqual($request->query, $_GET);
$this->assertEqual($request->url, $_GET['url']);
}
/**