From dce6587d9a2fe9782e67eeaa73c918ba1313ce16 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Wed, 18 Dec 2019 16:59:07 +0100 Subject: [PATCH] Add test for reset --- Tests/RegistryTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Tests/RegistryTest.php b/Tests/RegistryTest.php index 9693ab45d..b1246ea4e 100644 --- a/Tests/RegistryTest.php +++ b/Tests/RegistryTest.php @@ -122,4 +122,30 @@ public function testResetUnknownEntityManager() $registry->resetManager('default'); } + + public function testReset() + { + $conn = $this->getMockBuilder('Doctrine\DBAL\Connection')->disableOriginalConstructor()->getMock(); + $em = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock(); + $container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock(); + + $container->expects($this->once()) + ->method('get') + ->with($this->equalTo('doctrine.orm.default_entity_manager')) + ->will($this->returnValue($em)); + + $registry = new Registry( + $container, + [ + 'default' => $conn, + ], + [ + 'default' => 'doctrine.orm.default_entity_manager', + ], + 'default', + 'default' + ); + + $registry->reset(); + } }