mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Updated unit test for HTTP status codes
This commit is contained in:
parent
2ce2a2aaa9
commit
19afed0003
1 changed files with 13 additions and 4 deletions
|
@ -361,6 +361,7 @@ class CakeResponseTest extends CakeTestCase {
|
|||
/**
|
||||
* Tests the httpCodes method
|
||||
*
|
||||
* @expectedException CakeException
|
||||
*/
|
||||
public function testHttpCodes() {
|
||||
$response = new CakeResponse();
|
||||
|
@ -372,16 +373,16 @@ class CakeResponseTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $result);
|
||||
|
||||
$codes = array(
|
||||
1337 => 'Undefined Unicorn',
|
||||
1729 => 'Hardy-Ramanujan Located'
|
||||
381 => 'Unicorn Moved',
|
||||
555 => 'Unexpected Minotaur'
|
||||
);
|
||||
|
||||
$result = $response->httpCodes($codes);
|
||||
$this->assertTrue($result);
|
||||
$this->assertEquals(42, count($response->httpCodes()));
|
||||
|
||||
$result = $response->httpCodes(1337);
|
||||
$expected = array(1337 => 'Undefined Unicorn');
|
||||
$result = $response->httpCodes(381);
|
||||
$expected = array(381 => 'Unicorn Moved');
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$codes = array(404 => 'Sorry Bro');
|
||||
|
@ -392,6 +393,14 @@ class CakeResponseTest extends CakeTestCase {
|
|||
$result = $response->httpCodes(404);
|
||||
$expected = array(404 => 'Sorry Bro');
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
//Throws exception
|
||||
$response->httpCodes(array(
|
||||
0 => 'Nothing Here',
|
||||
-1 => 'Reverse Infinity',
|
||||
12345 => 'Universal Password',
|
||||
'Hello' => 'World'
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue