mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Moving query string params around. Updating test cases.
This commit is contained in:
parent
0bbd7fae2c
commit
51db3c80ef
2 changed files with 24 additions and 5 deletions
|
@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue