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:
mark_story 2008-10-21 02:04:42 +00:00
parent f5a8ce4612
commit a629da67b7

View file

@ -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