Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 821a160

Browse files
author
Kirill Fuchs
committed
added 100% coverage
1 parent 741ae03 commit 821a160

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

Diff for: composer.json

+11
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,16 @@
1919
"Fuzz\\HttpException\\": "src/",
2020
"Fuzz\\HttpException\\Tests\\": "tests/"
2121
}
22+
},
23+
"scripts": {
24+
"test": [
25+
"vendor/bin/phpunit"
26+
],
27+
"test-coverage": [
28+
"vendor/bin/phpunit --coverage-html tests/coverage"
29+
],
30+
"open-coverage": [
31+
"open -a \"Google Chrome\" tests/coverage/index.html"
32+
]
2233
}
2334
}

Diff for: tests/HttpExceptionTest.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Fuzz\HttpException\ConflictHttpException;
88
use Fuzz\HttpException\GoneHttpException;
99
use Fuzz\HttpException\HttpException;
10+
use Fuzz\HttpException\InternalServerErrorHttpException;
1011
use Fuzz\HttpException\LengthRequiredHttpException;
1112
use Fuzz\HttpException\MethodNotAllowedHttpException;
1213
use Fuzz\HttpException\NotAcceptableHttpException;
@@ -24,9 +25,13 @@ class HttpExceptionTest extends TestCase
2425
{
2526
public function testItCanGetError()
2627
{
27-
$exception = new HttpException();
28+
$exception = new HttpException(500, 'internal_server_error', 'Internal Server Error', [], 'Ooops!!!', 'Seems one of our developers unplugged the server again!', [], new \Exception('some error'));
2829
$exception->setError('stub_exception');
30+
$exception->setUserTitle('some title');
31+
$exception->setStatusCode(1000);
2932
$this->assertEquals('stub_exception', $exception->getError());
33+
$this->assertEquals('some title', $exception->getUserTitle());
34+
$this->assertEquals(1000, $exception->getStatusCode());
3035
}
3136

3237
public function testItCanGetStatusCode()
@@ -186,6 +191,14 @@ public function testUnsupportedMediaTypeHttpException()
186191
$this->assertEquals('foo', $exception->getErrorDescription());
187192
}
188193

194+
public function testInternalServerErrorHttpException()
195+
{
196+
$exception = new InternalServerErrorHttpException('foo', [], 'user title');
197+
$this->assertEquals(500, $exception->getStatusCode());
198+
$this->assertEquals('internal_server_error', $exception->getError());
199+
$this->assertEquals('foo', $exception->getErrorDescription());
200+
}
201+
189202
public function testNotImplementedHttpException()
190203
{
191204
$exception = new NotImplementedHttpException('foo', [], 'user title');

0 commit comments

Comments
 (0)