Skip to content

Commit 63db124

Browse files
authored
Word2007 Writer : Added unit test
1 parent 32aa83e commit 63db124

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/PhpWordTests/Writer/Word2007/Part/DocumentTest.php

+38
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,44 @@ public function testWriteCellStyleCellGridSpan(): void
645645
self::assertEquals(5, $element->getAttribute('w:val'));
646646
}
647647

648+
/**
649+
* covers ::_writeCellStyle.
650+
*/
651+
public function testWriteCellStyleCellNoWrapEnabled(): void
652+
{
653+
$phpWord = new PhpWord();
654+
$section = $phpWord->addSection();
655+
656+
$table = $section->addTable();
657+
$table->addRow();
658+
659+
$cell = $table->addCell(200);
660+
$cell->getStyle()->setNoWrap(true);
661+
662+
$doc = TestHelperDOCX::getDocument($phpWord);
663+
664+
self::assertTrue($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:noWrap'));
665+
}
666+
667+
/**
668+
* covers ::_writeCellStyle.
669+
*/
670+
public function testWriteCellStyleCellNoWrapDisabled(): void
671+
{
672+
$phpWord = new PhpWord();
673+
$section = $phpWord->addSection();
674+
675+
$table = $section->addTable();
676+
$table->addRow();
677+
678+
$cell = $table->addCell(200);
679+
$cell->getStyle()->setNoWrap(false);
680+
681+
$doc = TestHelperDOCX::getDocument($phpWord);
682+
683+
self::assertFalse($doc->elementExists('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:noWrap'));
684+
}
685+
648686
/**
649687
* Test write gutter and line numbering.
650688
*/

0 commit comments

Comments
 (0)