mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
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:
parent
ed6caf5d33
commit
16fa9effb0
1 changed files with 22 additions and 7 deletions
|
@ -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'];
|
||||
|
|
Loading…
Reference in a new issue