Skip to content

Commit 7c057db

Browse files
committed
Add some more tests
1 parent c566e2a commit 7c057db

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

‎tests/ParseTest.php‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use PHPUnit\Framework\TestCase;
4+
use RtfHtmlPhp\Document;
5+
use RtfHtmlPhp\Html\HtmlFormatter;
6+
7+
class ParseTest extends TestCase
8+
{
9+
public function testParse1()
10+
{
11+
$rtf = file_get_contents("tests/rtf/test1.rtf");
12+
$document = new Document($rtf);
13+
$formatter = new HtmlFormatter();
14+
$html = $formatter->Format($document);
15+
16+
// We only test that it does not throw an exception
17+
$this->assertTrue(true);
18+
}
19+
20+
public function testParseException1()
21+
{
22+
$this->expectException(\Exception::class);
23+
24+
$document = new Document('{\rtf1\ansi\ansicpg1252\deff0\deflang1046');
25+
$formatter = new HtmlFormatter();
26+
$html = $formatter->Format($document);
27+
}
28+
}

‎tests/rtf/test1.rtf‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{\rtf1\ansi\ansicpg1252\deff0\deflang1046{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}
2+
{\colortbl ;\red0\green0\blue0;}
3+
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\cf1\f0\fs16 Blusa Alongada decote V, manga longa.\par
4+
Shape contornando o corpo, aplica\'e7\'e3o do s\'edmbolo ROLAMO\'c7A na lateral.\par
5+
Tecido de viscose e elastano com amaciamento ecol\'f3gico que utiliza o \'f3leo extra\'eddo da casca de arroz.\par
6+
Possui \'f3timo caimento, \'e9 agrad\'e1vel ao toque e resistente ao pilling.\par
7+
}

0 commit comments

Comments
 (0)