Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when resetting manager registry #1103

Merged
merged 1 commit into from Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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();
}
}