Skip to content

Commit dc794a0

Browse files
authored
Update StyleTest.php - Add emptyStyle test for spacing
1 parent 9ac06cc commit dc794a0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/PhpWordTests/Writer/RTF/StyleTest.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function removeCr($field)
4343
*/
4444
public function testEmptyStyles(): void
4545
{
46-
$styles = ['Font', 'Paragraph', 'Section', 'Tab', 'Indentation'];
46+
$styles = ['Font', 'Indentation', 'Paragraph', 'Section', 'Spacing', 'Tab'];
4747
foreach ($styles as $style) {
4848
$objectClass = 'PhpOffice\\PhpWord\\Writer\\RTF\\Style\\' . $style;
4949
$object = new $objectClass();
@@ -52,6 +52,23 @@ public function testEmptyStyles(): void
5252
}
5353
}
5454

55+
/**
56+
* Test unmatched styles.
57+
*/
58+
public function testUnmatchedStyles(): void
59+
{
60+
$elements = ['Font', 'Indentation', 'Paragraph', 'Section', 'Spacing', 'Tab'];
61+
foreach ($elements as $element) {
62+
$parentWriter = new RTF();
63+
$writerClass = 'PhpOffice\\PhpWord\\Writer\\RTF\\Style\\' . $element;
64+
$style = new \PhpOffice\PhpWord\Style\Border();
65+
$writer = new $writerClass($style);
66+
$writer->setParentWriter($parentWriter);
67+
68+
self::assertEquals('', $object->write());
69+
}
70+
}
71+
5572
public function testBorderWithNonRegisteredColors(): void
5673
{
5774
$border = new Border();

0 commit comments

Comments
 (0)