add initial comment to accompanying period

This commit is contained in:
2021-05-18 19:04:09 +02:00
parent d327dae9fa
commit 2610730219
4 changed files with 110 additions and 6 deletions

View File

@@ -25,6 +25,7 @@ namespace Chill\PersonBundle\Tests\Entity;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
{
@@ -131,4 +132,23 @@ class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$this->assertNull($period->getRequestorPerson());
$this->assertNull($period->getRequestor());
}
public function testInitialComment()
{
$period = new AccompanyingPeriod(new \DateTime());
$comment = 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(NULL);
$this->assertNull($period->getInitialComment());
$this->assertNull($comment->getAccompanyingPeriod());
$this->assertEquals(0, count($period->getComments()), "The initial comment should not appears in the list of comments");
}
}