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