Completed
Push — master ( 406f94...da88ec )
by Alejandro
14s queued 11s
created

serviceIsCreated()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\Rest\Middleware;
5
6
use PHPUnit\Framework\TestCase;
7
use ReflectionObject;
8
use Shlinkio\Shlink\Rest\Middleware\EmptyResponseImplicitOptionsMiddlewareFactory;
9
use Zend\Diactoros\Response\EmptyResponse;
10
use Zend\Expressive\Router\Middleware\ImplicitOptionsMiddleware;
11
12
class EmptyResponseImplicitOptionsMiddlewareFactoryTest extends TestCase
13
{
14
    /** @var EmptyResponseImplicitOptionsMiddlewareFactory */
15
    private $factory;
16
17
    public function setUp(): void
18
    {
19
        $this->factory = new EmptyResponseImplicitOptionsMiddlewareFactory();
20
    }
21
22
    /** @test */
23
    public function serviceIsCreated(): void
24
    {
25
        $instance = ($this->factory)();
26
        $this->assertInstanceOf(ImplicitOptionsMiddleware::class, $instance);
27
    }
28
29
    /** @test */
30
    public function responsePrototypeIsEmptyResponse(): void
31
    {
32
        $instance = ($this->factory)();
33
34
        $ref = new ReflectionObject($instance);
35
        $prop = $ref->getProperty('responseFactory');
36
        $prop->setAccessible(true);
37
        $this->assertInstanceOf(EmptyResponse::class, $prop->getValue($instance)());
38
    }
39
}
40