complete tests for person edition

close #405

add a test on false date, but this made the validation fail.
This commit is contained in:
Julien Fastré 2015-01-29 18:42:42 +01:00
parent bf1eb51873
commit 0a1ff9e141
2 changed files with 12 additions and 7 deletions

View File

@ -9,7 +9,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse;
/** /**
* Test creation and deletion for persons * Test creation and deletion for persons
*/ */
class PersonControllerTest extends WebTestCase class PersonControllerCreateTest extends WebTestCase
{ {
const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]'; const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]';

View File

@ -30,7 +30,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
* *
* @author Julien Fastré <julien.fastre@champs-libres.coop> * @author Julien Fastré <julien.fastre@champs-libres.coop>
*/ */
class PersonUpdateTest extends WebTestCase class PersonControllerUpdateTest extends WebTestCase
{ {
/** /**
* *
@ -128,8 +128,10 @@ class PersonUpdateTest extends WebTestCase
$this->client->submit($form); $this->client->submit($form);
$this->em->refresh($this->person); $this->em->refresh($this->person);
$this->assertTrue($this->client->getResponse()->isRedirect($this->seeUrl)); $this->assertTrue($this->client->getResponse()->isRedirect($this->seeUrl),
$this->assertEquals($value, $callback($this->person)); 'the page is redirected to general view');
$this->assertEquals($value, $callback($this->person),
'the value '.$field.' is updated in db');
} }
/** /**
@ -176,8 +178,10 @@ class PersonUpdateTest extends WebTestCase
$crawler = $this->client->submit($form); $crawler = $this->client->submit($form);
$this->assertFalse($this->client->getResponse()->isRedirect()); $this->assertFalse($this->client->getResponse()->isRedirect(),
$this->assertGreaterThan(0, $crawler->filter('.error')->count()); 'the page is not redirected to /general');
$this->assertGreaterThan(0, $crawler->filter('.error')->count(),
'a element .error is shown');
} }
public function providesInvalidFieldsValues() public function providesInvalidFieldsValues()
@ -186,7 +190,8 @@ class PersonUpdateTest extends WebTestCase
['firstName', $this->getVeryLongText()], ['firstName', $this->getVeryLongText()],
['lastName', $this->getVeryLongText()], ['lastName', $this->getVeryLongText()],
['firstName', ''], ['firstName', ''],
['lastName', ''] ['lastName', ''],
['dateOfBirth', 'false date']
); );
} }