@@ -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