From 19ae1c7550098a46c84b749dffacaa2d51b75eb2 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Thu, 12 Sep 2024 18:04:58 +0200 Subject: [PATCH 1/2] test: Add test case for vMerge's default value of continue This new test case essentially covers the changes in b457ff5f7fadf28f4d62d1fcd5b9ee3424392835. It ensures the new behavior works as intended and doesn't break/change by accident in the future. --- .../Reader/Word2007/StyleTest.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tests/PhpWordTests/Reader/Word2007/StyleTest.php b/tests/PhpWordTests/Reader/Word2007/StyleTest.php index 015a3cfcb7..f622c57e90 100644 --- a/tests/PhpWordTests/Reader/Word2007/StyleTest.php +++ b/tests/PhpWordTests/Reader/Word2007/StyleTest.php @@ -165,6 +165,44 @@ public function testReadTableCellStyle(): void self::assertEquals('auto', $styleCell->getBorderBottomColor()); } + public function testReadTableCellsWithVerticalMerge(): void + { + $documentXml = ' + + + + + + + + + + + + + + + + + + '; + + $phpWord = $this->getDocumentFromString(['document' => $documentXml]); + + $table = $phpWord->getSection(0)->getElements()[0]; + self::assertInstanceOf('PhpOffice\PhpWord\Element\Table', $table); + + $rows = $table->getRows(); + self::assertCount(3, $rows); + foreach ($rows as $row) { + self::assertCount(1, $row->getCells()); + } + + self::assertSame('restart', $rows[0]->getCells()[0]->getStyle()->getVMerge()); + self::assertSame('continue', $rows[1]->getCells()[0]->getStyle()->getVMerge()); + self::assertNull($rows[2]->getCells()[0]->getStyle()->getVMerge()); + } + /** * Test reading of position. */ From 05d81709e91b55c35b6163ad537ab308a0b7cb83 Mon Sep 17 00:00:00 2001 From: Christian Koop Date: Fri, 13 Sep 2024 19:39:20 +0200 Subject: [PATCH 2/2] docs(changelog): Add note about added test case for vMerge default value --- docs/changes/1.x/1.4.0.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changes/1.x/1.4.0.md b/docs/changes/1.x/1.4.0.md index 13d9bc0937..8db845337d 100644 --- a/docs/changes/1.x/1.4.0.md +++ b/docs/changes/1.x/1.4.0.md @@ -15,5 +15,6 @@ ### Miscellaneous - Bump dompdf/dompdf from 2.0.4 to 3.0.0 by [@dependabot](https://github.com/dependabot) fixing [#2621](https://github.com/PHPOffice/PHPWord/issues/2621) in [#2666](https://github.com/PHPOffice/PHPWord/pull/2666) +- Add test case to make sure vMerge defaults to 'continue' by [@SpraxDev](https://github.com/SpraxDev) in [#2677](https://github.com/PHPOffice/PHPWord/pull/2677) ### BC Breaks