mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 14:25:00 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -17,13 +17,12 @@ use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdMember;
|
||||
use Chill\PersonBundle\Entity\Household\Position;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use DateTime;
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Unit tests for the person Entity.
|
||||
*
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
@@ -34,18 +33,18 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testAccompanyingPeriodOrderSameDateOpening()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$g = new DateTime('2013/4/1');
|
||||
$g = new \DateTime('2013/4/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($g);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/2/1');
|
||||
$f = new \DateTime('2013/2/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
@@ -62,18 +61,18 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testAccompanyingPeriodOrderWithUnorderedAccompanyingPeriod()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/1/1');
|
||||
$f = new \DateTime('2013/1/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$g = new DateTime('2013/4/1');
|
||||
$g = new \DateTime('2013/4/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($g);
|
||||
$p->close($period);
|
||||
|
||||
@@ -91,18 +90,18 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testDateCoveringWithCoveringAccompanyingPeriod()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/1/1');
|
||||
$f = new \DateTime('2013/1/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$g = new DateTime('2013/4/1');
|
||||
$g = new \DateTime('2013/4/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($g);
|
||||
$p->close($period);
|
||||
|
||||
@@ -118,7 +117,7 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testGetCurrentAccompanyingPeriod()
|
||||
{
|
||||
$d = new DateTime('yesterday');
|
||||
$d = new \DateTime('yesterday');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
@@ -128,8 +127,8 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertTrue($period->isOpen());
|
||||
$this->assertEquals($d, $period->getOpeningDate());
|
||||
|
||||
//close and test
|
||||
$period->setClosingDate(new DateTime('tomorrow'));
|
||||
// close and test
|
||||
$period->setClosingDate(new \DateTime('tomorrow'));
|
||||
|
||||
$shouldBeNull = $p->getCurrentAccompanyingPeriod();
|
||||
$this->assertNull($shouldBeNull);
|
||||
@@ -145,15 +144,15 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
->setShareHousehold(false);
|
||||
|
||||
$membership1 = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('10 years ago'))
|
||||
->setEndDate(new DateTimeImmutable('5 years ago'))
|
||||
->setStartDate(new \DateTimeImmutable('10 years ago'))
|
||||
->setEndDate(new \DateTimeImmutable('5 years ago'))
|
||||
->setPerson($person)
|
||||
->setPosition($positionShare);
|
||||
$household->addMember($membership1);
|
||||
|
||||
$membership2 = (new HouseholdMember())
|
||||
->setStartDate(new DateTimeImmutable('4 years ago'))
|
||||
->setEndDate(new DateTimeImmutable('2 years ago'))
|
||||
->setStartDate(new \DateTimeImmutable('4 years ago'))
|
||||
->setEndDate(new \DateTimeImmutable('2 years ago'))
|
||||
->setPerson($person)
|
||||
->setPosition($positionNotShare);
|
||||
$household->addMember($membership2);
|
||||
@@ -163,10 +162,10 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertFalse($person->isSharingHousehold());
|
||||
$this->assertTrue($person->isSharingHousehold(
|
||||
new DateTimeImmutable('6 years ago')
|
||||
new \DateTimeImmutable('6 years ago')
|
||||
));
|
||||
$this->assertFalse($person->isSharingHousehold(
|
||||
new DateTimeImmutable('3 years ago')
|
||||
new \DateTimeImmutable('3 years ago')
|
||||
));
|
||||
}
|
||||
|
||||
@@ -177,15 +176,15 @@ final class PersonTest extends \PHPUnit\Framework\TestCase
|
||||
*/
|
||||
public function testNotOpenAFileReOpenedLater()
|
||||
{
|
||||
$d = new DateTime('2013/2/1');
|
||||
$d = new \DateTime('2013/2/1');
|
||||
$p = new Person();
|
||||
$p->addAccompanyingPeriod(new AccompanyingPeriod($d));
|
||||
|
||||
$e = new DateTime('2013/3/1');
|
||||
$e = new \DateTime('2013/3/1');
|
||||
$period = $p->getCurrentAccompanyingPeriod()->setClosingDate($e);
|
||||
$p->close($period);
|
||||
|
||||
$f = new DateTime('2013/1/1');
|
||||
$f = new \DateTime('2013/1/1');
|
||||
$p->open(new AccompanyingPeriod($f));
|
||||
|
||||
$r = $p->checkAccompanyingPeriodsAreNotCollapsing();
|
||||
|
Reference in New Issue
Block a user