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