Skip to content

Commit

Permalink
Merge pull request #1103 from alcaeus/fix-managerregistry-reset
Browse files Browse the repository at this point in the history
Fix error when resetting manager registry
  • Loading branch information
alcaeus committed Dec 18, 2019
2 parents 6a81d1c + 8fcd448 commit f7f32a3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Registry.php
Expand Up @@ -168,7 +168,7 @@ public function getEntityManagerForClass($class)

public function reset() : void
{
foreach ($this->getManagerNames() as $managerName) {
foreach (array_keys($this->getManagerNames()) as $managerName) {
$this->resetManager($managerName);
}
}
Expand Down
16 changes: 16 additions & 0 deletions Tests/RegistryTest.php
Expand Up @@ -122,4 +122,20 @@ public function testResetUnknownEntityManager()

$registry->resetManager('default');
}

/**
* @group legacy
*/
public function testReset()
{
$em = new stdClass();
$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' => 'doctrine.orm.default_entity_manager'], 'default', 'default');
$registry->reset();
}
}

0 comments on commit f7f32a3

Please sign in to comment.