shlink/module/Common/test/Doctrine/EntityManagerFactoryTest.php

45 lines
1.2 KiB
PHP
Raw Normal View History

2016-04-17 21:27:24 +03:00
<?php
2017-10-12 11:13:20 +03:00
declare(strict_types=1);
namespace ShlinkioTest\Shlink\Common\Doctrine;
2016-04-17 21:27:24 +03:00
use Doctrine\ORM\EntityManager;
2017-03-24 22:34:18 +03:00
use PHPUnit\Framework\TestCase;
use Shlinkio\Shlink\Common\Doctrine\EntityManagerFactory;
use Shlinkio\Shlink\Common\Type\ChronosDateTimeType;
2016-04-17 21:27:24 +03:00
use Zend\ServiceManager\ServiceManager;
class EntityManagerFactoryTest extends TestCase
{
/** @var EntityManagerFactory */
private $factory;
2016-04-17 21:27:24 +03:00
2019-02-16 12:53:45 +03:00
public function setUp(): void
2016-04-17 21:27:24 +03:00
{
$this->factory = new EntityManagerFactory();
}
2019-02-17 22:28:34 +03:00
/** @test */
public function serviceIsCreated(): void
2016-04-17 21:27:24 +03:00
{
$sm = new ServiceManager(['services' => [
'config' => [
'debug' => true,
'entity_manager' => [
'orm' => [
'types' => [
ChronosDateTimeType::CHRONOS_DATETIME => ChronosDateTimeType::class,
],
],
'connection' => [
'driver' => 'pdo_sqlite',
],
2016-04-17 21:27:24 +03:00
],
],
]]);
$em = ($this->factory)($sm, EntityManager::class);
2016-04-17 21:27:24 +03:00
$this->assertInstanceOf(EntityManager::class, $em);
}
}