Anonymous Anonymous - 2 months ago
207 0

To test with the entitymanager in PHPUnit_Framework_TestCase you can get the entitymanager by the following code.

PHP

Symfony2 get entitymanager in PHPUnit_Framework_TestCase

$kernel = new \AppKernel('dev', true);
$kernel->boot();

$container = $kernel->getContainer();
$entityManager = $container->get('doctrine.orm.entity_manager');
Comments