batch replace/rename initialComment by pinnedComment

This commit is contained in:
2021-12-13 16:31:16 +01:00
parent 52a137ee77
commit f8071d32c0
7 changed files with 72 additions and 34 deletions

View File

@@ -60,28 +60,28 @@ final class AccompanyingPeriodTest extends \PHPUnit\Framework\TestCase
$this->assertFalse($period->isClosingAfterOpening());
}
public function testInitialComment()
public function testPinnedComment()
{
$period = new AccompanyingPeriod(new DateTime());
$comment = new Comment();
$replacingComment = new Comment();
$period->setInitialComment(null);
$this->assertNull($period->getInitialComment());
$period->setPinnedComment(null);
$this->assertNull($period->getPinnedComment());
$period->setInitialComment($comment);
$this->assertSame($period->getInitialComment(), $comment);
$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');
$period->setInitialComment($replacingComment);
$this->assertSame($period->getInitialComment(), $replacingComment);
$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());
$period->setInitialComment(null);
$this->assertNull($period->getInitialComment());
$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');
}