mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-12 20:49:50 +00:00
Adding tests to requestAction() for POST/$this->data passing in requestAction(). Closes #5628
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7767 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f5a8ce4612
commit
a629da67b7
1 changed files with 34 additions and 0 deletions
|
@ -102,6 +102,14 @@ class RequestActionController extends Controller {
|
|||
$data = $this->paginate();
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* post pass, testing post passing
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function post_pass() {
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* TestObject class
|
||||
|
@ -528,6 +536,32 @@ class ObjectTest extends CakeTestCase {
|
|||
Configure::write('viewPaths', $_back['view']);
|
||||
Configure::write('pluginPaths', $_back['plugin']);
|
||||
}
|
||||
/**
|
||||
* test requestAction and POST parameter passing, and not passing when url is an array.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testRequestActionPostPassing() {
|
||||
$_tmp = $_POST;
|
||||
|
||||
$_POST = array('data' => array(
|
||||
'item' => 'value'
|
||||
));
|
||||
$result = $this->object->requestAction(array('controller' => 'request_action', 'action' => 'post_pass'));
|
||||
$expected = array();
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction(array('controller' => 'request_action', 'action' => 'post_pass', 'data' => $_POST['data']));
|
||||
$expected = $_POST['data'];
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$result = $this->object->requestAction('/request_action/post_pass');
|
||||
$expected = $_POST['data'];
|
||||
$this->assertEqual($expected, $result);
|
||||
|
||||
$_POST = $_tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* testCakeError
|
||||
|
|
Loading…
Add table
Reference in a new issue