mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-09 16:53:11 +08:00
Created EntityManagerDecorator to handle the automatic reopening, and removed this behavior from ClosDbConnectionMiddleware
This commit is contained in:
44
module/Common/test/Doctrine/EntityManagerFactoryTest.php
Normal file
44
module/Common/test/Doctrine/EntityManagerFactoryTest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace ShlinkioTest\Shlink\Common\Doctrine;
|
||||
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Shlinkio\Shlink\Common\Doctrine\EntityManagerFactory;
|
||||
use Shlinkio\Shlink\Common\Type\ChronosDateTimeType;
|
||||
use Zend\ServiceManager\ServiceManager;
|
||||
|
||||
class EntityManagerFactoryTest extends TestCase
|
||||
{
|
||||
/** @var EntityManagerFactory */
|
||||
private $factory;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->factory = new EntityManagerFactory();
|
||||
}
|
||||
|
||||
/** @test */
|
||||
public function serviceIsCreated(): void
|
||||
{
|
||||
$sm = new ServiceManager(['services' => [
|
||||
'config' => [
|
||||
'debug' => true,
|
||||
'entity_manager' => [
|
||||
'orm' => [
|
||||
'types' => [
|
||||
ChronosDateTimeType::CHRONOS_DATETIME => ChronosDateTimeType::class,
|
||||
],
|
||||
],
|
||||
'connection' => [
|
||||
'driver' => 'pdo_sqlite',
|
||||
],
|
||||
],
|
||||
],
|
||||
]]);
|
||||
|
||||
$em = ($this->factory)($sm, EntityManager::class);
|
||||
$this->assertInstanceOf(EntityManager::class, $em);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user