mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix tests for accompanying period comments
This commit is contained in:
parent
199a441593
commit
9b4c350213
@ -1153,11 +1153,8 @@ class AccompanyingPeriod implements
|
||||
$this->removeComment($this->pinnedComment);
|
||||
}
|
||||
|
||||
if ($comment instanceof Comment) {
|
||||
if (null !== $this->pinnedComment) {
|
||||
$this->addComment($this->pinnedComment);
|
||||
}
|
||||
$this->addComment($comment);
|
||||
if (null !== $this->pinnedComment) {
|
||||
$this->addComment($this->pinnedComment);
|
||||
}
|
||||
|
||||
$this->pinnedComment = $comment;
|
||||
|
@ -129,20 +129,27 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertNull($period->getPinnedComment());
|
||||
|
||||
$period->setPinnedComment($comment);
|
||||
|
||||
$this->assertSame($period->getPinnedComment(), $comment);
|
||||
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||
$this->assertEquals(0, count($period->getComments()), 'The initial comment should not appears in the list of comments');
|
||||
$this->assertNull($comment->getAccompanyingPeriod());
|
||||
$this->assertEquals(0, count($period->getComments()));
|
||||
|
||||
$period->setPinnedComment($replacingComment);
|
||||
|
||||
$this->assertSame($period->getPinnedComment(), $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());
|
||||
$this->assertNull($replacingComment->getAccompanyingPeriod());
|
||||
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||
$this->assertEquals(1, count($period->getComments()));
|
||||
$this->assertContains($comment, $period->getComments());
|
||||
|
||||
$period->setPinnedComment(null);
|
||||
|
||||
$this->assertNull($period->getPinnedComment());
|
||||
$this->assertNull($replacingComment->getAccompanyingPeriod());
|
||||
$this->assertEquals(0, count($period->getComments()), 'The initial comment should not appears in the list of comments');
|
||||
$this->assertSame($period, $comment->getAccompanyingPeriod());
|
||||
$this->assertSame($period, $replacingComment->getAccompanyingPeriod());
|
||||
$this->assertEquals(2, count($period->getComments()));
|
||||
$this->assertContains($comment, $period->getComments());
|
||||
$this->assertContains($replacingComment, $period->getComments());
|
||||
}
|
||||
|
||||
public function testRequestor()
|
||||
|
Loading…
x
Reference in New Issue
Block a user