Skip to content

Commit

Permalink
Possibility to inherit from EntityManager for Presenter inject
Browse files Browse the repository at this point in the history
  • Loading branch information
foxycode authored and fprochazka committed Mar 10, 2016
1 parent 607fefa commit 53c47c9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/KdybyTests/Doctrine/Extension.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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());
15 changes: 15 additions & 0 deletions tests/KdybyTests/Doctrine/config/entitymanager-decorator.neon
Original file line number Diff line number Diff line change
@@ -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)
20 changes: 20 additions & 0 deletions tests/KdybyTests/DoctrineMocks/RemoteEntityManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* This file is part of the Kdyby (http://www.kdyby.org)
*
* Copyright (c) 2008 Filip Procházka ([email protected])
*
* For the full copyright and license information, please view the file license.txt that was distributed with this source code.
*/

namespace KdybyTests\DoctrineMocks;



/**
* @author Tomáš Jacík <[email protected]>
*/
class RemoteEntityManager extends \Doctrine\ORM\Decorator\EntityManagerDecorator
{
}

0 comments on commit 53c47c9

Please sign in to comment.