diff --git a/tests/KdybyTests/Doctrine/Extension.phpt b/tests/KdybyTests/Doctrine/Extension.phpt index 6a990029..11f30a50 100644 --- a/tests/KdybyTests/Doctrine/Extension.phpt +++ b/tests/KdybyTests/Doctrine/Extension.phpt @@ -109,6 +109,22 @@ class ExtensionTest extends Tester\TestCase ], $entityClasses); } + + + public function testInheritance() + { + $container = $this->createContainer('entitymanager-decorator'); + + Assert::same( + $container->getService('kdyby.doctrine.registry')->getConnection('default'), + $container->getByType('Kdyby\Doctrine\EntityManager')->getConnection() + ); + Assert::same( + $container->getService('kdyby.doctrine.registry')->getConnection('remote'), + $container->getByType('KdybyTests\DoctrineMocks\RemoteEntityManager')->getConnection() + ); + } + } \run(new ExtensionTest()); diff --git a/tests/KdybyTests/Doctrine/config/entitymanager-decorator.neon b/tests/KdybyTests/Doctrine/config/entitymanager-decorator.neon new file mode 100644 index 00000000..050e6b1e --- /dev/null +++ b/tests/KdybyTests/Doctrine/config/entitymanager-decorator.neon @@ -0,0 +1,15 @@ +kdyby.doctrine: + metadata: + KdybyTests\Doctrine: annotations(%appDir%/Doctrine/models) + + default: + driver: pdo_sqlite + memory: true + + remote: + driver: pdo_sqlite + memory: true + + +services: + - KdybyTests\DoctrineMocks\RemoteEntityManager(@kdyby.doctrine.remote.entityManager) diff --git a/tests/KdybyTests/DoctrineMocks/RemoteEntityManager.php b/tests/KdybyTests/DoctrineMocks/RemoteEntityManager.php new file mode 100644 index 00000000..8055b14d --- /dev/null +++ b/tests/KdybyTests/DoctrineMocks/RemoteEntityManager.php @@ -0,0 +1,20 @@ + + */ +class RemoteEntityManager extends \Doctrine\ORM\Decorator\EntityManagerDecorator +{ +}