mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-19 16:10:54 +00:00
Fixing requestAction parameter merging. Url params were being incorrectly set to empty array for both string urls and array urls. Tests added. Fixes #5628
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7770 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
c2fee87b63
commit
8cf8ee93ea
2 changed files with 32 additions and 6 deletions
|
@ -94,7 +94,10 @@ class Object {
|
||||||
if (in_array('return', $extra, true)) {
|
if (in_array('return', $extra, true)) {
|
||||||
$extra = array_merge($extra, array('return' => 0, 'autoRender' => 1));
|
$extra = array_merge($extra, array('return' => 0, 'autoRender' => 1));
|
||||||
}
|
}
|
||||||
$params = array_merge(array('autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1, 'url' => array()), $extra);
|
if (is_array($url)) {
|
||||||
|
$extra = array_merge(array('url' => array()), $extra);
|
||||||
|
}
|
||||||
|
$params = array_merge(array('autoRender' => 0, 'return' => 1, 'bare' => 1, 'requested' => 1), $extra);
|
||||||
$dispatcher = new Dispatcher;
|
$dispatcher = new Dispatcher;
|
||||||
return $dispatcher->dispatch($url, $params);
|
return $dispatcher->dispatch($url, $params);
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,11 +105,19 @@ class RequestActionController extends Controller {
|
||||||
/**
|
/**
|
||||||
* post pass, testing post passing
|
* post pass, testing post passing
|
||||||
*
|
*
|
||||||
* @return void
|
* @return array
|
||||||
**/
|
**/
|
||||||
function post_pass() {
|
function post_pass() {
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* test param passing and parsing.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function params_pass() {
|
||||||
|
return $this->params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* TestObject class
|
* TestObject class
|
||||||
|
@ -536,6 +544,21 @@ class ObjectTest extends CakeTestCase {
|
||||||
Configure::write('viewPaths', $_back['view']);
|
Configure::write('viewPaths', $_back['view']);
|
||||||
Configure::write('pluginPaths', $_back['plugin']);
|
Configure::write('pluginPaths', $_back['plugin']);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Test that requestAction() is populating $this->params properly
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testRequestActionParamParseAndPass() {
|
||||||
|
$result = $this->object->requestAction('/request_action/params_pass');
|
||||||
|
$this->assertTrue(isset($result['url']['url']));
|
||||||
|
$this->assertEqual($result['url']['url'], '/request_action/params_pass');
|
||||||
|
$this->assertEqual($result['controller'], 'request_action');
|
||||||
|
$this->assertEqual($result['action'], 'params_pass');
|
||||||
|
$this->assertEqual($result['form'], array());
|
||||||
|
$this->assertEqual($result['plugin'], null);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* test requestAction and POST parameter passing, and not passing when url is an array.
|
* test requestAction and POST parameter passing, and not passing when url is an array.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue