Skip to content

Commit e7b2e47

Browse files
committed
Cover 1 More Statement
1 parent cb16229 commit e7b2e47

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/PhpWordTests/Shared/Html2402Test.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,36 @@ public function testParseTableStyleBorder2px(): void
206206
$substring2 = 'border-top-style: dotted; border-top-color: #ff0000; border-top-width: 1.75pt; border-left-style: dotted; border-left-color: #ff0000; border-left-width: 1.75pt; border-bottom-style: dotted; border-bottom-color: #ff0000; border-bottom-width: 1.75pt; border-right-style: dotted; border-right-color: #ff0000; border-right-width: 1.75pt;';
207207
self::assertSame(1, substr_count($content, $substring2));
208208
}
209+
210+
public function testParseTableStyleBorderBadType(): void
211+
{
212+
$html = <<<HTML
213+
<table align="center" style="width: 50%;border:2px xashed green;">
214+
<thead>
215+
<tr>
216+
<th>header a</th>
217+
<th>header b</th>
218+
<th><span style="background-color: #00FF00;">header c</span></th>
219+
</tr>
220+
</thead>
221+
<tbody>
222+
<tr><td style="border: thick dotted red;">1</td><td colspan="2">2</td></tr>
223+
<tr><td>This is <b>bold</b> text</td><td></td><td>6</td></tr>
224+
</tbody>
225+
</table>
226+
HTML;
227+
$phpWord = new PhpWord();
228+
$section = $phpWord->addSection();
229+
Html::addHtml($section, $html, false, false);
230+
$elements = $section->getElements();
231+
$table = $elements[0];
232+
self::assertInstanceOf(Table::class, $table);
233+
$style = $table->getStyle();
234+
self::assertInstanceOf(TableStyle::class, $style);
235+
self::assertNull($style->getBorderBottomStyle());
236+
self::assertSame('', $style->getBorderInsideHStyle());
237+
self::assertSame('', $style->getBorderInsideVStyle());
238+
self::assertNull($style->getBorderBottomSize());
239+
self::assertNull($style->getBorderBottomColor());
240+
}
209241
}

0 commit comments

Comments
 (0)