From 008cb5b216ad19737c20ca2cdd587e7cd05abbe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 5 Mar 2015 15:45:26 +0100 Subject: [PATCH] fix refreshing person problem the entity "person" wasn't managed any more by the ORM, for an unknow reason. --- Tests/Controller/PersonControllerUpdateTest.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Tests/Controller/PersonControllerUpdateTest.php b/Tests/Controller/PersonControllerUpdateTest.php index 6196bb166..3756c8a38 100644 --- a/Tests/Controller/PersonControllerUpdateTest.php +++ b/Tests/Controller/PersonControllerUpdateTest.php @@ -76,6 +76,16 @@ class PersonControllerUpdateTest extends WebTestCase )); } + /** + * + * @return Person + */ + protected function refreshPerson() + { + $this->person = $this->em->getRepository('ChillPersonBundle:Person') + ->find($this->person->getId()); + } + /** * Test the edit page exist and rendering is successful */ @@ -126,7 +136,7 @@ class PersonControllerUpdateTest extends WebTestCase ->setValue($transformedValue); $this->client->submit($form); - $this->em->refresh($this->person); + $this->refreshPerson(); $this->assertTrue($this->client->getResponse()->isRedirect($this->seeUrl), 'the page is redirected to general view'); @@ -145,7 +155,7 @@ class PersonControllerUpdateTest extends WebTestCase ->setValue($selectedLanguages); $this->client->submit($form); - $this->em->refresh($this->person); + $this->refreshPerson(); $this->assertTrue($this->client->getResponse()->isRedirect($this->seeUrl), 'the page is redirected to /general view'); @@ -222,6 +232,7 @@ class PersonControllerUpdateTest extends WebTestCase public function tearDown() { + $this->refreshPerson(); $this->em->remove($this->person); $this->em->flush(); }