Skip to content

Commit

Permalink
Add test for reset
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Dec 18, 2019
1 parent fd472d8 commit dce6587
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Tests/RegistryTest.php
Expand Up @@ -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();
}
}

0 comments on commit dce6587

Please sign in to comment.