0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-09 15:28:40 +00:00

Standardize test-cases with the prefix Test_. Add framework for HTML_Purifier, its unit test will really only be for regression testing from integration issues. It's more important to test the components.

git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@35 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-04-16 03:39:39 +00:00
parent 69da034570
commit 1a3887de1b
5 changed files with 27 additions and 7 deletions

View File

@ -3,7 +3,23 @@
class HTML_Purifier
{
var $lexer;
var $definition;
var $generator;
function HTML_Purifier() {
$this->lexer = new HTML_Lexer();
$this->definition = new PureHTMLDefinition();
$this->generator = new HTML_Generator();
}
function purify($html) {
$tokens = $this->lexer->tokenizeHTML($html);
$tokens = $this->definition->purifyTokens($tokens);
return $this->generator->generateFromTokens($tokens);
}
}

View File

@ -1,11 +1,11 @@
<?php
class UnitTest_HTML_Generator extends UnitTestCase
class Test_HTML_Generator extends UnitTestCase
{
var $gen;
function UnitTest_HTML_Generator() {
function Test_HTML_Generator() {
$this->UnitTestCase();
$this->gen = new HTML_Generator();
}

View File

@ -4,7 +4,7 @@
* Benchmark the SAX parser with my homemade one
*/
class TestCase_HTML_Lexer extends UnitTestCase
class Test_HTML_Lexer extends UnitTestCase
{
var $HTML_Lexer;

View File

@ -1,9 +1,13 @@
<?php
class TestCase_HTML_Purifier extends UnitTestCase
class Test_HTML_Purifier extends UnitTestCase
{
function Test_HTML_Purifier() {
}
}

View File

@ -1,11 +1,11 @@
<?php
class UnitTest_PureHTMLDefinition extends UnitTestCase
class Test_PureHTMLDefinition extends UnitTestCase
{
var $def;
function UnitTest_PureHTMLDefinition() {
function Test_PureHTMLDefinition() {
$this->UnitTestCase();
$this->def = new PureHTMLDefinition();
$this->def->loadData();