mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Merge branch 'master' into 'fix-accompanying-period-opening'
# Conflicts: # src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseApiController.php
This commit is contained in:
@@ -25,6 +25,8 @@ namespace Chill\PersonBundle\Tests\Entity;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\ThirdPartyBundle\Entity\ThirdParty;
|
||||
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
|
||||
|
||||
class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
@@ -120,4 +122,56 @@ class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertNull($period->getOpenParticipationContainsPerson($person4));
|
||||
$this->assertEquals(1, $period->getParticipationsContainsPerson($person4)->count());
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
public function testInitialComment()
|
||||
{
|
||||
$period = new AccompanyingPeriod(new \DateTime());
|
||||
$comment = new Comment();
|
||||
$replacingComment = new Comment();
|
||||
|
||||
$period->setInitialComment(NULL);
|
||||
$this->assertNull($period->getInitialComment());
|
||||
|
||||
$period->setInitialComment($comment);
|
||||
$this->assertSame($period->getInitialComment(), $comment);
|
||||
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||
$this->assertEquals(0, count($period->getComments()), "The initial comment should not appears in the list of comments");
|
||||
|
||||
$period->setInitialComment($replacingComment);
|
||||
$this->assertSame($period->getInitialComment(), $replacingComment);
|
||||
$this->assertSame($period, $replacingComment->getAccompanyingPeriod());
|
||||
$this->assertEquals(0, count($period->getComments()), "The initial comment should not appears in the list of comments");
|
||||
$this->assertNull($comment->getAccompanyingPeriod());
|
||||
|
||||
$period->setInitialComment(NULL);
|
||||
$this->assertNull($period->getInitialComment());
|
||||
$this->assertNull($replacingComment->getAccompanyingPeriod());
|
||||
$this->assertEquals(0, count($period->getComments()), "The initial comment should not appears in the list of comments");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user