diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php index 57444dfaa..f7dd055c6 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerCreateTest.php @@ -93,8 +93,6 @@ class PersonControllerCreateTest extends WebTestCase 'The page contains a "gender" 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::GENDER_INPUT); $this->assertEquals('radio', $genderType->getType(), @@ -107,10 +105,6 @@ class PersonControllerCreateTest extends WebTestCase 'gender has "femme" option'); $this->assertFalse($genderType->hasValue(), 'The gender input is not checked'); - $today = new \DateTime(); - $this->assertEquals($today->format('d-m-Y'), $form->get(self::CREATEDATE_INPUT) - ->getValue(), 'The creation date input has the current date by default'); - return $form; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Entity/PersonTest.php b/src/Bundle/ChillPersonBundle/Tests/Entity/PersonTest.php index 7e9337d14..dbef739d1 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Entity/PersonTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Entity/PersonTest.php @@ -45,11 +45,12 @@ class PersonTest extends \PHPUnit\Framework\TestCase public function testGetCurrentAccompanyingPeriod() { $d = new \DateTime('yesterday'); - $p = new Person($d); + $p = new Person(); + $p->addAccompanyingPeriod(new AccompanyingPeriod($d)); $period = $p->getCurrentAccompanyingPeriod(); - $this->assertInstanceOf('Chill\PersonBundle\Entity\AccompanyingPeriod', $period); + $this->assertInstanceOf(AccompanyingPeriod::class, $period); $this->assertTrue($period->isOpen()); $this->assertEquals($d, $period->getOpeningDate()); @@ -67,7 +68,8 @@ class PersonTest extends \PHPUnit\Framework\TestCase public function testAccompanyingPeriodOrderWithUnorderedAccompanyingPeriod() { $d = new \DateTime("2013/2/1"); - $p = new Person($d); + $p = new Person(); + $p->addAccompanyingPeriod(new AccompanyingPeriod($d)); $e = new \DateTime("2013/3/1"); $period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e); @@ -93,7 +95,8 @@ class PersonTest extends \PHPUnit\Framework\TestCase */ public function testAccompanyingPeriodOrderSameDateOpening() { $d = new \DateTime("2013/2/1"); - $p = new Person($d); + $p = new Person(); + $p->addAccompanyingPeriod(new AccompanyingPeriod($d)); $g = new \DateTime("2013/4/1"); $period = $p->getCurrentAccompanyingPeriod()->setClosingDate($g); @@ -120,7 +123,8 @@ class PersonTest extends \PHPUnit\Framework\TestCase */ public function testDateCoveringWithCoveringAccompanyingPeriod() { $d = new \DateTime("2013/2/1"); - $p = new Person($d); + $p = new Person(); + $p->addAccompanyingPeriod(new AccompanyingPeriod($d)); $e = new \DateTime("2013/3/1"); $period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e); @@ -145,7 +149,8 @@ class PersonTest extends \PHPUnit\Framework\TestCase */ public function testNotOpenAFileReOpenedLater() { $d = new \DateTime("2013/2/1"); - $p = new Person($d); + $p = new Person(); + $p->addAccompanyingPeriod(new AccompanyingPeriod($d)); $e = new \DateTime("2013/3/1"); $period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);