LiipFunctionalTestBundle icon indicating copy to clipboard operation
LiipFunctionalTestBundle copied to clipboard

ODM support? WebTestCase::cleanDatabase requires ORM\EntityManager

Open PWalkow opened this issue 9 years ago • 2 comments

Official documentation says it is possible to use mongodb as connection $this->loadFixtures($fixtures, null, 'doctrine_mongodb'); but when tried we see: Liip\FunctionalTestBundle\Test\WebTestCase::cleanDatabase() must be an instance of Doctrine\ORM\EntityManager, instance of Doctrine\ODM\MongoDB\DocumentManager given

Liip\FunctionalTestBundle\Test\WebTestCase::cleanDatabase requires Doctrine\ORM\EntityManager (Hardcoded dependency to ORM) not Doctrine\Common\Persistence\ObjectManager interface

https://github.com/liip/LiipFunctionalTestBundle/blob/master/Test/WebTestCase.php#L476

PWalkow avatar Jul 14 '16 16:07 PWalkow

Does replacing Doctrine\ORM\EntityManager with Doctrine\Common\Persistence\ObjectManager in the arguments resolve your problem? Can you please provide a Pull Request?

alexislefebvre avatar Jul 15 '16 12:07 alexislefebvre

@PWalkow the issue is that you are passing null as the append parameter, but it needs to be false otherwise the command will run in "append" mode which is only supported for the ORM. but maybe we can add another check there to ensure append mode is only active for the ORM

lsmith77 avatar Jul 18 '16 07:07 lsmith77