mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-24 21:58:40 +03:00
28 lines
846 B
PHP
28 lines
846 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace ShlinkioTest\Shlink\Common\Doctrine;
|
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
|
use PHPUnit\Framework\TestCase;
|
|
use ReflectionObject;
|
|
use Shlinkio\Shlink\Common\Doctrine\ReopeningEntityManagerDelegator;
|
|
use Zend\ServiceManager\ServiceManager;
|
|
|
|
class ReopeningEntityManagerDelegatorTest extends TestCase
|
|
{
|
|
/** @test */
|
|
public function decoratesEntityManagerFromCallback(): void
|
|
{
|
|
$em = $this->prophesize(EntityManagerInterface::class)->reveal();
|
|
$result = (new ReopeningEntityManagerDelegator())(new ServiceManager(), '', function () use ($em) {
|
|
return $em;
|
|
});
|
|
|
|
$ref = new ReflectionObject($result);
|
|
$prop = $ref->getProperty('wrapped');
|
|
$prop->setAccessible(true);
|
|
|
|
$this->assertSame($em, $prop->getValue($result));
|
|
}
|
|
}
|