tests/ChillPersonBundle: replace testGenderIsNull with crafted form as html input now prevents user form not selecting a gender

This commit is contained in:
Christophe Siraut 2021-04-20 10:51:37 +02:00
parent 395735e6f7
commit e4e2138765

View File

@ -114,14 +114,14 @@ class PersonControllerCreateTest extends WebTestCase
* @param Form $form * @param Form $form
* @depends testAddAPersonPage * @depends testAddAPersonPage
*/ */
public function testGenderIsNull(Form $form) public function testForgedNullGender(Form $form)
{ {
$this->fillAValidCreationForm($form); $form->get(self::FIRSTNAME_INPUT)->setValue('john');
$form->get(self::GENDER_INPUT)->disableValidation()->setValue(NULL); $form->get(self::LASTNAME_INPUT)->setValue('doe');
$crawler = $this->getAuthenticatedClient()->submit($form); $date = new \DateTime('1947-02-01');
$form->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
$this->assertEquals(1, $crawler->filter('.error')->count(), $this->client->submit($form);
'A message is shown if gender is not set'); $this->assertResponseStatusCodeSame(500);
} }
/** /**