Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
76 lines (67 loc) · 2.28 KB

File metadata and controls

76 lines (67 loc) · 2.28 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Tests\PHPCensor;
use PHPCensor\Exception\HttpException;
class HttpExceptionTest extends \PHPUnit\Framework\TestCase
{
public function testHttpExceptionIsException()
{
$ex = new HttpException();
self::assertTrue($ex instanceof \Exception);
}
public function testHttpException()
{
try {
throw new HttpException('Test');
} catch (HttpException $ex) {
self::assertTrue($ex->getMessage() == 'Test');
self::assertTrue($ex->getErrorCode() == 500);
self::assertTrue($ex->getStatusMessage() == 'Internal Server Error');
self::assertTrue($ex->getHttpHeader() == 'HTTP/1.1 500 Internal Server Error');
}
}
public function testBadRequestException()
{
try {
throw new HttpException\BadRequestException('Test');
} catch (HttpException $ex) {
self::assertTrue($ex->getErrorCode() == 400);
self::assertTrue($ex->getStatusMessage() == 'Bad Request');
}
}
public function testForbiddenException()
{
try {
throw new HttpException\ForbiddenException('Test');
} catch (HttpException $ex) {
self::assertTrue($ex->getErrorCode() == 403);
self::assertTrue($ex->getStatusMessage() == 'Forbidden');
}
}
public function testNotAuthorizedException()
{
try {
throw new HttpException\NotAuthorizedException('Test');
} catch (HttpException $ex) {
self::assertTrue($ex->getErrorCode() == 401);
self::assertTrue($ex->getStatusMessage() == 'Not Authorized');
}
}
public function testNotFoundException()
{
try {
throw new HttpException\NotFoundException('Test');
} catch (HttpException $ex) {
self::assertTrue($ex->getErrorCode() == 404);
self::assertTrue($ex->getStatusMessage() == 'Not Found');
}
}
public function testServerErrorException()
{
try {
throw new HttpException\ServerErrorException('Test');
} catch (HttpException $ex) {
self::assertTrue($ex->getErrorCode() == 500);
self::assertTrue($ex->getStatusMessage() == 'Internal Server Error');
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.