2016-04-17 21:27:24 +03:00
|
|
|
<?php
|
2017-10-12 11:13:20 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-07-19 18:38:41 +03:00
|
|
|
namespace ShlinkioTest\Shlink\Common\Factory;
|
2016-04-17 21:27:24 +03:00
|
|
|
|
|
|
|
use Doctrine\ORM\EntityManager;
|
2017-03-24 22:34:18 +03:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2016-07-19 18:38:41 +03:00
|
|
|
use Shlinkio\Shlink\Common\Factory\EntityManagerFactory;
|
2016-04-17 21:27:24 +03:00
|
|
|
use Zend\ServiceManager\ServiceManager;
|
|
|
|
|
|
|
|
class EntityManagerFactoryTest extends TestCase
|
|
|
|
{
|
2018-11-20 21:30:27 +03:00
|
|
|
/** @var EntityManagerFactory */
|
2018-11-20 21:37:22 +03:00
|
|
|
private $factory;
|
2016-04-17 21:27:24 +03:00
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
|
|
|
$this->factory = new EntityManagerFactory();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @test
|
|
|
|
*/
|
|
|
|
public function serviceIsCreated()
|
|
|
|
{
|
|
|
|
$sm = new ServiceManager(['services' => [
|
|
|
|
'config' => [
|
|
|
|
'debug' => true,
|
2016-08-06 13:40:31 +03:00
|
|
|
'entity_manager' => [
|
|
|
|
'connection' => [
|
|
|
|
'driver' => 'pdo_sqlite',
|
|
|
|
],
|
2016-04-17 21:27:24 +03:00
|
|
|
],
|
|
|
|
],
|
|
|
|
]]);
|
|
|
|
|
|
|
|
$em = $this->factory->__invoke($sm, EntityManager::class);
|
|
|
|
$this->assertInstanceOf(EntityManager::class, $em);
|
|
|
|
}
|
|
|
|
}
|