Skip to content
Permalink
Browse files

Fixing some issues with parameter handling. Adding test cases.

  • Loading branch information...
markstory committed Apr 26, 2010
1 parent f17eebe commit 15a460706123fb31833752a59c9298c1bd5f784a
Showing with 24 additions and 3 deletions.
  1. +6 −2 cake/libs/cake_request.php
  2. +18 −1 cake/tests/cases/libs/cake_request.test.php
@@ -79,6 +79,10 @@ protected function _processPost() {
}
unset($this->params['form']['_method']);
}
if (isset($this->params['form']['data'])) {
$this->data = $this->params['form']['data'];
unset($this->params['form']['data']);
}
}
/**
@@ -93,9 +97,9 @@ protected function _processGet() {
$url = $_GET;
}
if (isset($this->params['url'])) {
$this->params['url'] = array_merge($this->params['url'], $url);
$this->url = array_merge($this->url, $url);
} else {
$this->params['url'] = $url;
$this->url = $url;
}
}
@@ -38,6 +38,23 @@ function testConstructionGetParsing() {
'two' => 'banana'
);
$request = new CakeRequest();
$this->assertEqual($request->params['url'], $_GET);
$this->assertEqual($request->url, $_GET);
}
/**
* test parsing POST data into the object.
*
* @return void
*/
function testPostParsing() {
$_POST = array('data' => array(
'Article' => array('title')
));
$request = new CakeRequest();
$this->assertEqual($request->data, $_POST['data']);
$_POST = array('one' => 1, 'two' => 'three');
$request = new CakeRequest();
$this->assertEqual($request->params['form'], $_POST);
}
}

0 comments on commit 15a4607

Please sign in to comment.
You can’t perform that action at this time.