1919namespace PhpOffice \PhpWordTests \Writer \RTF \Style ;
2020
2121use PhpOffice \PhpWord \Settings ;
22+ use PhpOffice \PhpWord \Element \Text as TextElement ;
2223use PhpOffice \PhpWord \Style \Font as FontStyle ;
2324use PhpOffice \PhpWord \Style \Language ;
2425use PhpOffice \PhpWord \Writer \RTF ;
26+ use PhpOffice \PhpWord \Writer \RTF \Element \Text as TextWriter ;
2527use PhpOffice \PhpWord \Writer \RTF \Style \Font as FontWriter ;
2628use PHPUnit \Framework \TestCase ;
2729
@@ -70,6 +72,8 @@ public function testFontColorRegistered(): void
7072 $ phpWord = new \PhpOffice \PhpWord \PhpWord ();
7173 $ parentWriter = new RTF ($ phpWord );
7274 $ style = new FontStyle ();
75+ $ element = new TextElement ();
76+ $ writer = new TextWriter ($ parentWriter , $ element );
7377
7478 $ style ->setName ('Times New Roman ' );
7579 $ style ->setFallbackFont ('serif ' );
@@ -81,8 +85,9 @@ public function testFontColorRegistered(): void
8185 $ phpWord ->addFontStyle ('style1 ' , $ style );
8286 $ parentWriter ->getWriterPart ('Header ' )->write ();
8387
84- $ writer = new FontWriter ($ style );
85- $ writer ->setParentWriter ($ parentWriter );
88+ $ element ->setText ('Test ' );
89+ $ element ->setFontStyle ($ style );
90+
8691 $ expect = '\f0\fs48\cf0\highlight0\cb0 ' ;
8792 self ::assertEquals ($ expect , $ this ->removeCr ($ writer ));
8893 }
0 commit comments