diff --git a/tests/PhpSpreadsheetTests/CommentTest.php b/tests/PhpSpreadsheetTests/CommentTest.php index f7c1290b..c41267e6 100644 --- a/tests/PhpSpreadsheetTests/CommentTest.php +++ b/tests/PhpSpreadsheetTests/CommentTest.php @@ -4,6 +4,7 @@ namespace PhpOffice\PhpSpreadsheetTests; use PhpOffice\PhpSpreadsheet\Comment; use PhpOffice\PhpSpreadsheet\RichText\RichText; +use PhpOffice\PhpSpreadsheet\RichText\TextElement; use PhpOffice\PhpSpreadsheet\Style\Alignment; use PhpOffice\PhpSpreadsheet\Style\Color; use PHPUnit\Framework\TestCase; @@ -73,4 +74,13 @@ class CommentTest extends TestCase $comment->setAlignment(Alignment::HORIZONTAL_CENTER); self::assertEquals(Alignment::HORIZONTAL_CENTER, $comment->getAlignment()); } + + public function testSetText(): void + { + $comment = new Comment(); + $test = new RichText(); + $test->addText(new TextElement('This is a test comment')); + $comment->setText($test); + self::assertEquals('This is a test comment', (string) $comment); + } }