php - Symfony : Detached entity cannot be removed in test suite w/ phpunit -
i'm doing functionnal testing on api , i'm facing problem don't understand.
i want test api interact remote web hosting server. goal manage virtualhosts, dns zones, database etc... have test remote server , avoid conflicts, remove created stuff after test (in teardown()
function) , create base (in setup()
function). in setup()
load fixtures in setup.
after test add child of main entity, want clean remote server :
$service = $this->fixtures->getreference('service-web'); $this->container->get('webmanager')->deletehosting($service, true);
the deletehosting()
function deletes remote stuff (the true parameter "force" parameter, ensure function doesn't stop after error.
the $service
variable contains main service entity. have in entity one-to-many relationship addondomain
's entity. functionnal test creates addondomain. test ok, when try delete service, attached entity makes doctrine yell hell : doctrine\orm\orminvalidargumentexception: detached entity appbundle\entity\service\web\addondomain@0000000054814da900000000073c524a cannot removed
.
i tried lot of things none of them works (ie : using doctrine manager retrieve entity instead of using fixture.
thanks lot help, best regards.
solved ! in fact, i'm using container , entity manager of test class , not of client himself. problem...
Comments
Post a Comment