mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix tests
This commit is contained in:
parent
8fb4a7110e
commit
647bdb2749
@ -275,7 +275,7 @@ final class PersonController extends AbstractController
|
||||
return $this->redirectToRoute('chill_person_general_edit',
|
||||
['person_id' => $person->getId()]);
|
||||
}
|
||||
} elseif ($request->getMethod() === Request::METHOD_POST) {
|
||||
} elseif ($request->getMethod() === Request::METHOD_POST && !$form->isValid()) {
|
||||
$this->addFlash('error', $this->translator->trans('This form contains errors'));
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname.'_'.uniqid());
|
||||
$creationForm->get(self::GENDER_INPUT)->select("man");
|
||||
$date = new \DateTime('1947-02-01');
|
||||
$creationForm->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
|
||||
$creationForm->get(self::BIRTHDATE_INPUT)->setValue($date->format('Y-m-d'));
|
||||
|
||||
return $creationForm;
|
||||
}
|
||||
@ -114,15 +114,18 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
*
|
||||
* @param Form $form
|
||||
* @return string The id of the created person
|
||||
* @depends testAddAPersonPage
|
||||
*/
|
||||
public function testValidForm(Form $form)
|
||||
public function testValidForm()
|
||||
{
|
||||
$client = $this->client;
|
||||
$crawler = $client->request('GET', '/fr/person/new');
|
||||
|
||||
$form = $crawler->selectButton("Ajouter la personne")->form();
|
||||
$this->fillAValidCreationForm($form);
|
||||
$client = $this->client;
|
||||
$crawler = $client->submit($form);
|
||||
$client->submit($form);
|
||||
|
||||
$this->assertTrue((bool)$client->getResponse()->isRedirect(),
|
||||
$this->assertTrue($client->getResponse()->isRedirect(),
|
||||
"a valid form redirect to url /{_locale}/person/{personId}/general/edit");
|
||||
$client->followRedirect();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user