Passed
Pull Request — master (#437)
by Alejandro
09:16
created

EntityManagerFactoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 14
c 0
b 0
f 0
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A serviceIsCreated() 0 20 1
1
<?php
2
declare(strict_types=1);
3
4
namespace ShlinkioTest\Shlink\Common\Doctrine;
5
6
use Doctrine\ORM\EntityManager;
7
use PHPUnit\Framework\TestCase;
8
use Shlinkio\Shlink\Common\Doctrine\EntityManagerFactory;
9
use Shlinkio\Shlink\Common\Type\ChronosDateTimeType;
10
use Zend\ServiceManager\ServiceManager;
11
12
class EntityManagerFactoryTest extends TestCase
13
{
14
    /** @var EntityManagerFactory */
15
    private $factory;
16
17
    public function setUp(): void
18
    {
19
        $this->factory = new EntityManagerFactory();
20
    }
21
22
    /** @test */
23
    public function serviceIsCreated(): void
24
    {
25
        $sm = new ServiceManager(['services' => [
26
            'config' => [
27
                'debug' => true,
28
                'entity_manager' => [
29
                    'orm' => [
30
                        'types' => [
31
                            ChronosDateTimeType::CHRONOS_DATETIME => ChronosDateTimeType::class,
32
                        ],
33
                    ],
34
                    'connection' => [
35
                        'driver' => 'pdo_sqlite',
36
                    ],
37
                ],
38
            ],
39
        ]]);
40
41
        $em = ($this->factory)($sm, EntityManager::class);
42
        $this->assertInstanceOf(EntityManager::class, $em);
43
    }
44
}
45