fix refreshing person problem

the entity "person" wasn't managed any more by the ORM, for an unknow reason.
This commit is contained in:
Julien Fastré 2015-03-05 15:45:26 +01:00
parent e2e89d433f
commit 008cb5b216

View File

@ -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();
}