-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some simple tests for the parser
- Loading branch information
1 parent
176c076
commit 7214101
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
namespace Helper; | ||
|
||
use Bobv\LatexBundle\Helper\Parser; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class ParserTest extends TestCase | ||
{ | ||
|
||
public function testSimpleNode(): void | ||
{ | ||
$text = '<p>Some test text</p>'; | ||
|
||
$this->assertEquals( | ||
"\nSome test text\n\n", | ||
Parser::parseHtml($text), | ||
); | ||
} | ||
|
||
public function testSimpleNodeWithBold(): void | ||
{ | ||
$text = '<p>Some <b>test</b> text</p>'; | ||
|
||
$this->assertEquals( | ||
"\nSome \\textbf{test} text\n\n", | ||
Parser::parseHtml($text), | ||
); | ||
} | ||
|
||
public function testSimpleNodeWithItalic(): void | ||
{ | ||
$text = '<p>Some <em>test</em> text</p>'; | ||
|
||
$this->assertEquals( | ||
"\nSome \\textit{test} text\n\n", | ||
Parser::parseHtml($text), | ||
); | ||
} | ||
|
||
public function testDoubleNode(): void | ||
{ | ||
$text = '<p><b>Some</b> <em>test</em> text</p>'; | ||
|
||
$this->assertEquals( | ||
"\n\\textbf{Some} \\textit{test} text\n\n", | ||
Parser::parseHtml($text), | ||
); | ||
} | ||
|
||
public function testDoubleOverlappingNode(): void | ||
{ | ||
$text = '<p><b>Some <em>test</em></b> text</p>'; | ||
|
||
$this->assertEquals( | ||
"\n\\textbf{Some \\textit{test}} text\n\n", | ||
Parser::parseHtml($text), | ||
); | ||
} | ||
|
||
public function testDoubleEqualNode(): void | ||
{ | ||
$text = '<p>Some <b><em>test</em></b> text</p>'; | ||
|
||
$this->assertEquals( | ||
"\nSome \\textbf{\\textit{test}} text\n\n", | ||
Parser::parseHtml($text), | ||
); | ||
} | ||
} |