Passed
Branch stable (668427)
by Nuno
04:13 queued 01:26
created

ProviderTest::it_gets_the_handler()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Tests\Unit;
4
5
use Whoops\Run;
6
use Whoops\RunInterface;
7
use PHPUnit\Framework\TestCase;
8
use NunoMaduro\Collision\Handler;
9
use NunoMaduro\Collision\Provider;
10
use NunoMaduro\Collision\Contracts\Provider as ProviderContract;
11
12
class ProviderTest extends TestCase
13
{
14
    /** @test */
15
    public function it_respects_is_contract(): void
16
    {
17
        $this->assertInstanceOf(ProviderContract::class, new Provider());
18
    }
19
20
    /** @test */
21
    public function it_registers_the_error_handler(): void
22
    {
23
        $handler = new Handler();
24
25
        $runMock = $this->createMock(RunInterface::class);
26
27
        $runMock->expects($this->once())
28
            ->method('pushHandler')
29
            ->with($handler)
30
            ->willReturn($runMock);
31
32
        $runMock->expects($this->once())
33
            ->method('register');
34
35
        (new Provider($runMock, $handler))->register();
36
    }
37
38
    /** @test */
39
    public function it_gets_the_handler(): void
40
    {
41
        $handler = new Handler();
42
        $provider = new Provider(new Run(), $handler);
43
44
        $this->assertEquals($provider->getHandler(), $handler);
45
    }
46
}
47