mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
handling multi types and acc-period/repositories endpoint
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user