mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'fix-accompanying-period-opening' into bootstrap-api
This commit is contained in:
commit
33457d3cbc
@ -401,7 +401,7 @@ class AccompanyingPeriod
|
|||||||
{
|
{
|
||||||
$participation = $this->getOpenParticipationContainsPerson($person);
|
$participation = $this->getOpenParticipationContainsPerson($person);
|
||||||
|
|
||||||
if (! null === $participation) {
|
if ($participation instanceof AccompanyingPeriodParticipation) {
|
||||||
$participation->setEndDate(new \DateTimeImmutable('now'));
|
$participation->setEndDate(new \DateTimeImmutable('now'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ class Person implements HasCenterInterface
|
|||||||
*
|
*
|
||||||
* @deprecated since 1.1 use `getOpenedAccompanyingPeriod instead
|
* @deprecated since 1.1 use `getOpenedAccompanyingPeriod instead
|
||||||
*/
|
*/
|
||||||
public function getCurrentAccompanyingPeriod() : AccompanyingPeriod
|
public function getCurrentAccompanyingPeriod() : ?AccompanyingPeriod
|
||||||
{
|
{
|
||||||
return $this->getOpenedAccompanyingPeriod();
|
return $this->getOpenedAccompanyingPeriod();
|
||||||
}
|
}
|
||||||
@ -1011,7 +1011,7 @@ class Person implements HasCenterInterface
|
|||||||
* By default, the addresses are ordered by date, descending (the most
|
* By default, the addresses are ordered by date, descending (the most
|
||||||
* recent first)
|
* recent first)
|
||||||
*/
|
*/
|
||||||
public function getAddresses(): ArrayCollection
|
public function getAddresses(): Collection
|
||||||
{
|
{
|
||||||
return $this->addresses;
|
return $this->addresses;
|
||||||
}
|
}
|
||||||
|
@ -79,19 +79,27 @@ class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
|||||||
public function testPersonPeriod()
|
public function testPersonPeriod()
|
||||||
{
|
{
|
||||||
$person = new Person();
|
$person = new Person();
|
||||||
|
$person2 = new Person();
|
||||||
|
$person3 = new Person();
|
||||||
$period = new AccompanyingPeriod(new \DateTime());
|
$period = new AccompanyingPeriod(new \DateTime());
|
||||||
|
|
||||||
$period->addPerson($person);
|
$period->addPerson($person);
|
||||||
|
$period->addPerson($person2);
|
||||||
|
$period->addPerson($person3);
|
||||||
|
|
||||||
$this->assertEquals(1, $period->getParticipations()->count());
|
$this->assertEquals(3, $period->getParticipations()->count());
|
||||||
$this->assertTrue($period->containsPerson($person));
|
$this->assertTrue($period->containsPerson($person));
|
||||||
|
$this->assertFalse($period->containsPerson(new Person()));
|
||||||
|
|
||||||
$participation = $period->getOpenParticipationContainsPerson($person);
|
$participation = $period->getOpenParticipationContainsPerson($person);
|
||||||
$participations = $period->getParticipationsContainsPerson($person);
|
$participations = $period->getParticipationsContainsPerson($person);
|
||||||
$this->assertNotNull($participation);
|
$this->assertNotNull($participation);
|
||||||
|
$this->assertSame($person, $participation->getPerson());
|
||||||
$this->assertEquals(1, $participations->count());
|
$this->assertEquals(1, $participations->count());
|
||||||
|
|
||||||
$period->removePerson($person);
|
$participationL = $period->removePerson($person);
|
||||||
|
$this->assertSame($participationL, $participation);
|
||||||
|
$this->assertTrue($participation->getEndDate() instanceof \DateTimeInterface);
|
||||||
|
|
||||||
$participation = $period->getOpenParticipationContainsPerson($person);
|
$participation = $period->getOpenParticipationContainsPerson($person);
|
||||||
$this->assertNull($participation);
|
$this->assertNull($participation);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user