Skip to content

Commit ebe5a58

Browse files
authored
Update FontTest.php
1 parent 76ab10b commit ebe5a58

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/PhpWordTests/Writer/RTF/Style/FontTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
namespace PhpOffice\PhpWordTests\Writer\RTF\Style;
2020

2121
use PhpOffice\PhpWord\Settings;
22+
use PhpOffice\PhpWord\Element\Text as TextElement;
2223
use PhpOffice\PhpWord\Style\Font as FontStyle;
2324
use PhpOffice\PhpWord\Style\Language;
2425
use PhpOffice\PhpWord\Writer\RTF;
26+
use PhpOffice\PhpWord\Writer\RTF\Element\Text as TextWriter;
2527
use PhpOffice\PhpWord\Writer\RTF\Style\Font as FontWriter;
2628
use 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

Comments
 (0)