Set requestor for accompanying period

This commit is contained in:
2021-05-10 15:59:34 +02:00
parent 3447117742
commit 4f3f16d9b0
10 changed files with 193 additions and 19 deletions

View File

@@ -24,6 +24,7 @@ namespace Chill\PersonBundle\Tests\Entity;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
{
@@ -104,4 +105,30 @@ class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$participation = $period->getOpenParticipationContainsPerson($person);
$this->assertNull($participation);
}
public function testRequestor()
{
$period = new AccompanyingPeriod(new \DateTime());
$person = new Person();
$thirdParty = new ThirdParty();
$this->assertNull($period->getRequestorThirdParty());
$this->assertNull($period->getRequestorPerson());
$this->assertNull($period->getRequestor());
$period->setRequestor($person);
$this->assertNull($period->getRequestorThirdParty());
$this->assertSame($person, $period->getRequestorPerson());
$this->assertSame($person, $period->getRequestor());
$period->setRequestor($thirdParty);
$this->assertNull($period->getRequestorPerson());
$this->assertSame($thirdParty, $period->getRequestorThirdParty());
$this->assertSame($thirdParty, $period->getRequestor());
$period->setRequestor(NULL);
$this->assertNull($period->getRequestorThirdParty());
$this->assertNull($period->getRequestorPerson());
$this->assertNull($period->getRequestor());
}
}