diff --git a/tests/PhpWordTests/Element/CellTest.php b/tests/PhpWordTests/Element/CellTest.php index 919d627bfb..076ccabce1 100644 --- a/tests/PhpWordTests/Element/CellTest.php +++ b/tests/PhpWordTests/Element/CellTest.php @@ -20,6 +20,7 @@ use BadMethodCallException; use PhpOffice\PhpWord\Element\Cell; +use PhpOffice\PhpWord\Style\Cell as CellStyle; use PhpOffice\PhpWordTests\AbstractWebServerEmbedded; /** @@ -51,6 +52,20 @@ public function testConstructWithStyleArray(): void self::assertNull($oCell->getWidth()); } + /** + * New instance with array. + */ + public function testConstructWithStyleObject(): void + { + $oStyle = (new CellStyle())->setWidth(17); + $oCell = new Cell(null, $oStyle); + + self::assertNotNull($oCell->getStyle()); + self::assertInstanceOf(CellStyle::class, $oCell->getStyle()); + self::assertSame($oStyle, $oCell->getStyle()); + self::assertEquals(17, $oCell->getWidth()); + } + /** * Add text. */