Skip to content

Commit 19ae1c7

Browse files
committed
test: Add test case for vMerge's default value of continue
This new test case essentially covers the changes in b457ff5. It ensures the new behavior works as intended and doesn't break/change by accident in the future.
1 parent f0ec497 commit 19ae1c7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/PhpWordTests/Reader/Word2007/StyleTest.php

+38
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,44 @@ public function testReadTableCellStyle(): void
165165
self::assertEquals('auto', $styleCell->getBorderBottomColor());
166166
}
167167

168+
public function testReadTableCellsWithVerticalMerge(): void
169+
{
170+
$documentXml = '<w:tbl>
171+
<w:tr>
172+
<w:tc>
173+
<w:tcPr>
174+
<w:vMerge w:val="restart" />
175+
</w:tcPr>
176+
</w:tc>
177+
</w:tr>
178+
<w:tr>
179+
<w:tc>
180+
<w:tcPr>
181+
<w:vMerge />
182+
</w:tcPr>
183+
</w:tc>
184+
</w:tr>
185+
<w:tr>
186+
<w:tc />
187+
</w:tr>
188+
</w:tbl>';
189+
190+
$phpWord = $this->getDocumentFromString(['document' => $documentXml]);
191+
192+
$table = $phpWord->getSection(0)->getElements()[0];
193+
self::assertInstanceOf('PhpOffice\PhpWord\Element\Table', $table);
194+
195+
$rows = $table->getRows();
196+
self::assertCount(3, $rows);
197+
foreach ($rows as $row) {
198+
self::assertCount(1, $row->getCells());
199+
}
200+
201+
self::assertSame('restart', $rows[0]->getCells()[0]->getStyle()->getVMerge());
202+
self::assertSame('continue', $rows[1]->getCells()[0]->getStyle()->getVMerge());
203+
self::assertNull($rows[2]->getCells()[0]->getStyle()->getVMerge());
204+
}
205+
168206
/**
169207
* Test reading of position.
170208
*/

0 commit comments

Comments
 (0)