RethrowHandlerTest::testHandleShallThrow()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace VM\ErrorHandler\Tests\Services;
6
7
use PHPUnit\Framework\TestCase;
8
use TypeError;
9
use VM\ErrorHandler\Exceptions\Http\Forbidden;
10
use VM\ErrorHandler\Exceptions\HttpException;
11
use VM\ErrorHandler\Services\RethrowHandler;
12
13
class RethrowHandlerTest extends TestCase
14
{
15
    public function testHandleShallThrow(): void
16
    {
17
        $this->expectException(TypeError::class);
18
        $handler = new RethrowHandler();
19
        $exception = new TypeError();
20
        $handler->handle($exception);
21
    }
22
23
    public function testHandleHttpExceptionShallThrow(): void
24
    {
25
        $this->expectException(HttpException::class);
26
        $handler = new RethrowHandler();
27
        $exception = new Forbidden();
28
        $handler->handleHttpException($exception);
29
    }
30
}
31