RethrowHandlerTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testHandleHttpExceptionShallThrow() 0 6 1
A testHandleShallThrow() 0 6 1
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