handling multi types and acc-period/repositories endpoint

This commit is contained in:
2021-05-13 00:54:32 +02:00
parent 4a04628d5b
commit 87e2ac9386
9 changed files with 434 additions and 6 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace Chill\PersonBundle\Tests\Entity\AccompanyingPeriod;
use PHPUnit\Framework\TestCase;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
class ResourceTest extends TestCase
{
public function testSetResource()
{
$person = new Person();
$thirdParty = new ThirdParty();
$resource = new Resource();
$resource->setResource($person);
$this->assertSame($person, $resource->getResource());
$this->assertNull($resource->getThirdParty());
$resource->setResource($thirdParty);
$this->assertSame($thirdParty, $resource->getResource());
$this->assertNull($resource->getPerson());
// we repeat adding a person, to ensure that third party is
// well reset
$resource->setResource($person);
$this->assertSame($person, $resource->getResource());
$this->assertNull($resource->getThirdParty());
$resource->setResource(null);
$this->assertNull($resource->getThirdParty());
$this->assertNull($resource->getPerson());
$this->assertNull($resource->getResource());
}
}