mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix person creation validation close #369
This commit is contained in:
parent
10da02f9ba
commit
1f2c8bdb72
@ -17,11 +17,14 @@ Chill\PersonBundle\Entity\Person:
|
||||
max: 255
|
||||
minMessage: 'This name is too short. It must containt {{ limit }} chars'
|
||||
maxMessage: 'This name is too long. It must containt {{ limit }} chars'
|
||||
groups: [general]
|
||||
groups: [general, creation]
|
||||
dateOfBirth:
|
||||
- Date:
|
||||
message: 'Birthdate not valid'
|
||||
groups: [general, creation]
|
||||
genre:
|
||||
- NotNull:
|
||||
groups: [general, creation]
|
||||
history:
|
||||
- Valid:
|
||||
traverse: true
|
||||
|
@ -4,6 +4,7 @@ namespace Chill\PersonBundle\Tests\Controller;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\DomCrawler\Form;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
|
||||
/**
|
||||
* Test creation and deletion for persons
|
||||
@ -156,11 +157,23 @@ class PersonControllerTest extends WebTestCase
|
||||
$this->assertTrue($client->getResponse()->isRedirect(),
|
||||
"a valid form redirect to url /{_locale}/person/{personId}/general/edit");
|
||||
$client->followRedirect();
|
||||
$this->assertRegExpl('^/fr/person/[0-9]*/general/edit',
|
||||
$client->getResponse()->getHeader('location'),
|
||||
|
||||
// visualize regexp here : http://jex.im/regulex/#!embed=false&flags=&re=%2Ffr%2Fperson%2F[1-9][0-9]*%2Fgeneral%2Fedit%24
|
||||
$this->assertRegExp('|/fr/person/[1-9][0-9]*/general/edit$|',
|
||||
$client->getHistory()->current()->getUri(),
|
||||
"a valid form redirect to url /{_locale}/person/{personId}/general/edit");
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
static::bootKernel();
|
||||
$em = static::$kernel->getContainer()->get('doctrine.orm.entity_manager');
|
||||
$jesus = $em->getRepository('ChillPersonBundle:Person')
|
||||
->findOneBy(array('firstName' => 'God'));
|
||||
$em->remove($jesus);
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user