mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Merge pull request #5744 from cakephp/master-hotfix-testing
Fix ControllerTestCase redirect assert by always using 302 for redirect()
This commit is contained in:
commit
b5cbe4de58
2 changed files with 5 additions and 3 deletions
|
@ -751,7 +751,7 @@ class Controller extends Object implements CakeEventListener {
|
||||||
*
|
*
|
||||||
* @param string|array $url A string or array-based URL pointing to another location within the app,
|
* @param string|array $url A string or array-based URL pointing to another location within the app,
|
||||||
* or an absolute URL
|
* or an absolute URL
|
||||||
* @param int $status Optional HTTP status code (eg: 404)
|
* @param int|array|null $status HTTP status code (eg: 301). Defaults to 302 when null is passed.
|
||||||
* @param bool $exit If true, exit() will be called after the redirect
|
* @param bool $exit If true, exit() will be called after the redirect
|
||||||
* @return void
|
* @return void
|
||||||
* @triggers Controller.beforeRedirect $this, array($url, $status, $exit)
|
* @triggers Controller.beforeRedirect $this, array($url, $status, $exit)
|
||||||
|
@ -785,9 +785,10 @@ class Controller extends Object implements CakeEventListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($status) {
|
if ($status === null) {
|
||||||
$this->response->statusCode($status);
|
$status = 302;
|
||||||
}
|
}
|
||||||
|
$this->response->statusCode($status);
|
||||||
|
|
||||||
if ($exit) {
|
if ($exit) {
|
||||||
$this->response->send();
|
$this->response->send();
|
||||||
|
|
|
@ -297,6 +297,7 @@ class ControllerTestCaseTest extends CakeTestCase {
|
||||||
'Location' => 'http://cakephp.org'
|
'Location' => 'http://cakephp.org'
|
||||||
);
|
);
|
||||||
$this->assertEquals($expected, $results);
|
$this->assertEquals($expected, $results);
|
||||||
|
$this->assertSame(302, $Controller->response->statusCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue