mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Added test to show (deprecated?) support of string status codes in redirect().
Fixed fail on string status codes in redirect(). git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7410 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
8284872b82
commit
570145d568
2 changed files with 16 additions and 6 deletions
|
@ -540,7 +540,7 @@ class Controller extends Object {
|
|||
}
|
||||
|
||||
if (isset($codes[$status])) {
|
||||
$code = $status = $codes[$status];
|
||||
$code = $msg = $codes[$status];
|
||||
if (is_numeric($status)) {
|
||||
$code = $status;
|
||||
}
|
||||
|
|
|
@ -539,6 +539,7 @@ class ControllerTest extends CakeTestCase {
|
|||
Mock::generatePartial('Controller', 'MockController', array('header'));
|
||||
App::import('Helper', 'Cache');
|
||||
|
||||
// $codes = array_merge($codes, array_flip($codes));
|
||||
foreach ($codes as $code => $msg) {
|
||||
$MockController =& new MockController();
|
||||
$MockController->components = array('Test');
|
||||
|
@ -547,6 +548,15 @@ class ControllerTest extends CakeTestCase {
|
|||
$MockController->expectCallCount('header', 2);
|
||||
$MockController->redirect($url, (int) $code, false);
|
||||
}
|
||||
$codes = array_flip($codes);
|
||||
foreach ($codes as $code => $msg) {
|
||||
$MockController =& new MockController();
|
||||
$MockController->components = array('Test');
|
||||
$MockController->Component =& new Component();
|
||||
$MockController->Component->init($MockController);
|
||||
$MockController->expectCallCount('header', 2);
|
||||
$MockController->redirect($url, $code, false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* testMergeVars method
|
||||
|
|
Loading…
Reference in a new issue