Completed
Push — master ( b53e51...1009f9 )
by Alejandro
04:13 queued 38s
created

setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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