4 /* Copyright (C) 2004, Reini Urban <rurban@x-ray.at>
7 require_once 'lib/HtmlParser.php';
8 require_once 'PHPUnit.php';
10 define('USE_GLOBAL_SAX',false); // this seems to be a xml bug
12 class HtmlParserTest extends phpwiki_TestCase {
14 function testSimple() {
16 "<B>bold</B>" => "*bold*",
17 "<STRONG>strong</STRONG>" => "*strong*",
18 "<I>italic</I>" => "_italic_",
19 "<EM>emphasized</EM>" => "_emphasized_",
21 "<DT><DD>Indent</DD></DT>" => ";:Indent",
22 "<NOWIKI>nowiki</NOWIKI>" => "<verbatim>\nnowiki\n</verbatim>",
23 "<DL><DT> Def </DT><DD> List</DD></DL>" => "; Def : List",
26 $parser = new HtmlParser("PhpWiki2"); // will not work!
27 foreach ($html2wiki as $html => $wiki) {
28 if (!USE_GLOBAL_SAX) // redefine it for every run.
29 $parser = new HtmlParser("PhpWiki2");
31 $parser->parse($html,false); // is_final is false
33 $parser->parse($html);
34 $this->assertEquals($wiki, trim($parser->output()));
36 unset($GLOBALS['xml_parser_root']);
38 $parser->__destruct();
45 // (c-file-style: "gnu")
50 // c-hanging-comment-ender-p: nil
51 // indent-tabs-mode: nil