Renaming genre into gender & dateOfBirth into birthdate

This commit is contained in:
Marc Ducobu
2015-08-11 17:47:11 +02:00
parent 02193505be
commit 31e734f2c7
24 changed files with 189 additions and 111 deletions

View File

@@ -22,6 +22,8 @@
namespace Chill\PersonBundle\Tests\Controller;
ini_set('memory_limit', '-1');
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
@@ -84,7 +86,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
->setFirstName('Roland')
->setLastName('Gallorime')
->setCenter($center)
->setGenre(Person::GENRE_MAN);
->setGender(Person::MALE_GENDER);
static::$em->persist($this->person);
static::$em->flush();

View File

@@ -33,8 +33,8 @@ class PersonControllerCreateTest extends WebTestCase
const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]';
const LASTNAME_INPUT = "chill_personbundle_person_creation[lastName]";
const GENRE_INPUT = "chill_personbundle_person_creation[genre]";
const DATEOFBIRTH_INPUT = "chill_personbundle_person_creation[dateOfBirth]";
const GENDER_INPUT = "chill_personbundle_person_creation[gender]";
const BIRTHDATE_INPUT = "chill_personbundle_person_creation[birthdate]";
const CREATEDATE_INPUT = "chill_personbundle_person_creation[creation_date]";
const CENTER_INPUT = "chill_personbundle_person_creation[center]";
@@ -62,9 +62,9 @@ class PersonControllerCreateTest extends WebTestCase
{
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname);
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname);
$creationForm->get(self::GENRE_INPUT)->select("man");
$creationForm->get(self::GENDER_INPUT)->select("man");
$date = new \DateTime('1947-02-01');
$creationForm->get(self::DATEOFBIRTH_INPUT)->setValue($date->format('d-m-Y'));
$creationForm->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
return $creationForm;
}
@@ -90,14 +90,14 @@ class PersonControllerCreateTest extends WebTestCase
'The page contains a "firstname" input');
$this->assertTrue($form->has(self::LASTNAME_INPUT),
'The page contains a "lastname" input');
$this->assertTrue($form->has(self::GENRE_INPUT),
$this->assertTrue($form->has(self::GENDER_INPUT),
'The page contains a "gender" input');
$this->assertTrue($form->has(self::DATEOFBIRTH_INPUT),
$this->assertTrue($form->has(self::BIRTHDATE_INPUT),
'The page has a "date of birth" input');
$this->assertTrue($form->has(self::CREATEDATE_INPUT),
'The page contains a "creation date" input');
$genderType = $form->get(self::GENRE_INPUT);
$genderType = $form->get(self::GENDER_INPUT);
$this->assertEquals('radio', $genderType->getType(),
'The gender input has two radio button: man and women');
$this->assertEquals(2, count($genderType->availableOptionValues()),
@@ -154,7 +154,7 @@ class PersonControllerCreateTest extends WebTestCase
public function testGenderIsNull(Form $form)
{
$this->fillAValidCreationForm($form);
$form->get(self::GENRE_INPUT)->disableValidation()->setValue(NULL);
$form->get(self::GENDER_INPUT)->disableValidation()->setValue(NULL);
$crawler = $this->getAuthenticatedClient()->submit($form);
$this->assertEquals(1, $crawler->filter('.error')->count(),

View File

@@ -67,7 +67,7 @@ class PersonControllerUpdateTest extends WebTestCase
->setLastName("My Beloved")
->setFirstName("Jesus")
->setCenter($center)
->setGenre(Person::GENRE_MAN);
->setGender(Person::MALE_GENDER);
$this->em->persist($this->person);
$this->em->flush();
@@ -229,18 +229,18 @@ class PersonControllerUpdateTest extends WebTestCase
['firstName', 'random Value', function(Person $person) { return $person->getFirstName(); } ],
['lastName' , 'random Value', function(Person $person) { return $person->getLastName(); } ],
['placeOfBirth', 'none place', function(Person $person) { return $person->getPlaceOfBirth(); }],
['dateOfBirth', '15-12-1980', function(Person $person) { return $person->getDateOfBirth()->format('d-m-Y'); }],
['birthdate', '15-12-1980', function(Person $person) { return $person->getBirthdate()->format('d-m-Y'); }],
['phonenumber', '0123456789', function(Person $person) { return $person->getPhonenumber(); }],
['memo', 'jfkdlmq jkfldmsq jkmfdsq', function(Person $person) { return $person->getMemo(); }],
['countryOfBirth', 'BE', function(Person $person) { return $person->getCountryOfBirth()->getCountryCode(); }],
['nationality', 'FR', function(Person $person) { return $person->getNationality()->getCountryCode(); }],
['placeOfBirth', '', function(Person $person) { return $person->getPlaceOfBirth(); }],
['dateOfBirth', '', function(Person $person) { return $person->getDateOfBirth(); }],
['birthdate', '', function(Person $person) { return $person->getBirthdate(); }],
['phonenumber', '', function(Person $person) { return $person->getPhonenumber(); }],
['memo', '', function(Person $person) { return $person->getMemo(); }],
['countryOfBirth', NULL, function(Person $person) { return $person->getCountryOfBirth(); }],
['nationality', NULL, function(Person $person) { return $person->getNationality(); }],
['genre', Person::GENRE_WOMAN, function(Person $person) { return $person->getGenre(); }]
['gender', Person::FEMALE_GENDER, function(Person $person) { return $person->getGender(); }]
);
}
@@ -251,7 +251,7 @@ class PersonControllerUpdateTest extends WebTestCase
['lastName', $this->getVeryLongText()],
['firstName', ''],
['lastName', ''],
['dateOfBirth', 'false date']
['birthdate', 'false date']
);
}

View File

@@ -56,7 +56,7 @@ class PersonControllerViewTest extends WebTestCase
->setLastName("Tested Person")
->setFirstName("Réginald")
->setCenter($center)
->setGenre(Person::GENRE_MAN);
->setGender(Person::MALE_GENDER);
$this->em->persist($this->person);
$this->em->flush();

View File

@@ -1,6 +1,9 @@
imports:
- { resource: parameters.yml }
parameters:
locale: en
framework:
secret: Not very secret
router: { resource: "%kernel.root_dir%/config/routing.yml" }

View File

@@ -138,7 +138,7 @@ class PersonSearchTest extends WebTestCase
"assert clause firstname and nationality are AND");
}
public function testSearchDateOfBirth()
public function testSearchBirthdate()
{
$crawler = $this->generateCrawlerForSearch('@person birthdate:1948-12-27');
@@ -146,7 +146,7 @@ class PersonSearchTest extends WebTestCase
$this->assertRegExp('/Bart/', $crawler->text());
}
public function testSearchCombineDateOfBirthAndFirstName()
public function testSearchCombineBirthdateAndFirstName()
{
$crawler = $this->generateCrawlerForSearch('@person birthdate:1948-12-27 firstname:(Van Snick)');
@@ -154,7 +154,7 @@ class PersonSearchTest extends WebTestCase
$this->assertNotRegExp('/Depardieu/', $crawler->text());
}
public function testSearchCombineGenreAndFirstName()
public function testSearchCombineGenderAndFirstName()
{
$crawler = $this->generateCrawlerForSearch('@person gender:woman firstname:(Depardieu)');