2016-04-17 21:27:24 +03:00
|
|
|
<?php
|
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;
|
|
|
|
use PHPUnit_Framework_TestCase as 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
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var EntityManagerFactory
|
|
|
|
*/
|
|
|
|
protected $factory;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|