1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 19:30:21 +02:00

Cleanup final renaming stuff (how could I forget to rename the class) and hook in the SAX parser. It has a bit different behavior, so you'll have to be careful.

git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@21 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-04-15 01:47:12 +00:00
parent bf331d3a13
commit 181d544b61
2 changed files with 58 additions and 8 deletions

View File

@@ -1,16 +1,18 @@
<?php
class TestCase_MarkupLexer extends UnitTestCase
class TestCase_HTML_Lexer extends UnitTestCase
{
var $MarkupLexer;
var $HTML_Lexer;
var $HTML_Lexer_Sax;
function setUp() {
$this->MarkupLexer =& new MarkupLexer();
$this->HTML_Lexer =& new HTML_Lexer();
$this->HTML_Lexer_Sax =& new HTML_Lexer_Sax();
}
function test_nextWhiteSpace() {
$HP =& $this->MarkupLexer;
$HP =& $this->HTML_Lexer;
$this->assertIdentical(false, $HP->nextWhiteSpace('asdf'));
$this->assertIdentical(0, $HP->nextWhiteSpace(' asdf'));
$this->assertIdentical(0, $HP->nextWhiteSpace("\nasdf"));
@@ -90,9 +92,13 @@ class TestCase_MarkupLexer extends UnitTestCase
$size = count($input);
for($i = 0; $i < $size; $i++) {
$result = $this->MarkupLexer->tokenizeHTML($input[$i]);
$result = $this->HTML_Lexer->tokenizeHTML($input[$i]);
$this->assertEqual($expect[$i], $result);
paintIf($result, $expect[$i] != $result);
// since I didn't write the parser, I can't define its behavior
// however, make sure that the class runs without any errors
$exp_result = $this->HTML_Lexer_Sax->tokenizeHTML($input[$i]);
}
}
@@ -116,7 +122,7 @@ class TestCase_MarkupLexer extends UnitTestCase
$size = count($input);
for($i = 0; $i < $size; $i++) {
$result = $this->MarkupLexer->tokenizeAttributeString($input[$i]);
$result = $this->HTML_Lexer->tokenizeAttributeString($input[$i]);
$this->assertEqual($expect[$i], $result);
paintIf($result, $expect[$i] != $result);
}