closes #4918, allowing multiple calls to testAction() in the same test run with supplied get data without interfering with the get data needed for the testsuite to work and also ignoring the get data used for the previous call to testAction

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7194 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
DarkAngelBGE 2008-06-15 10:24:52 +00:00
parent ed6caf5d33
commit 16fa9effb0

View file

@ -77,6 +77,7 @@ class CakeTestCase extends UnitTestCase {
*/
var $methods = array('start', 'end', 'startcase', 'endcase', 'starttest', 'endtest');
var $__truncated = true;
var $__savedGetData = array();
/**
* By default, all fixtures attached to this class will be truncated and reloaded after each test.
* Set this to false to handle manually
@ -262,14 +263,28 @@ class CakeTestCase extends UnitTestCase {
$params = array_merge($default, $params);
if (!empty($params['data'])) {
$data = array('data' => $params['data']);
$toSave = array(
'case' => null,
'group' => null,
'app' => null,
'output' => null,
'show' => null,
'plugin' => null
);
$this->__savedGetData = (empty($this->__savedGetData))
? array_intersect_key($_GET, $toSave)
: $this->__savedGetData;
if (strtolower($params['method']) == 'get') {
$_GET = $data;
} else {
$_POST = $data;
}
$data = (!empty($params['data']))
? array('data' => $params['data'])
: array();
if (strtolower($params['method']) == 'get') {
$_GET = array_merge($this->__savedGetData, $data);
$_POST = array();
} else {
$_POST = $data;
$_GET = $this->__savedGetData;
}
$return = $params['return'];