mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Household/composition add + fixes household composition editor
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Entity\Household;
|
||||
|
||||
use Chill\PersonBundle\Entity\Household\Household;
|
||||
use Chill\PersonBundle\Entity\Household\HouseholdComposition;
|
||||
use DateTimeImmutable;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
final class HouseholdTest extends TestCase
|
||||
{
|
||||
public function testHouseholdComposition()
|
||||
{
|
||||
$household = new Household();
|
||||
|
||||
$household->addComposition(($first = new HouseholdComposition())
|
||||
->setStartDate(new DateTimeImmutable('2021-12-01')));
|
||||
|
||||
$this->assertNull($first->getEndDate());
|
||||
|
||||
$household->addComposition(($second = new HouseholdComposition())
|
||||
->setStartDate(new DateTimeImmutable('2021-12-31')));
|
||||
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $first->getEndDate());
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $second->getStartDate());
|
||||
|
||||
$household->addComposition(($inside = new HouseholdComposition())
|
||||
->setStartDate(new DateTimeImmutable('2021-12-15')));
|
||||
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-15'), $first->getEndDate());
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $second->getStartDate());
|
||||
$this->assertEquals(new DateTimeImmutable('2021-12-31'), $inside->getEndDate());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user