From cafa24482dc41e1b4b101cc3c0ebef435094bd7a Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 22 Jul 2006 00:13:08 +0000 Subject: [PATCH] Setup include web. Unit tests should now be able to be run independently. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@75 48356398-32a2-884e-a903-53898d9a118a --- Definition.php | 5 +++++ HTMLPurifier.php | 6 ++++-- Lexer.php | 2 ++ TODO.txt | 1 - benchmarks/HTML_Lexer.php | 6 ++++-- tests/ChildDef.php | 4 ++++ tests/Definition.php | 3 +++ tests/Generator.php | 2 ++ tests/HTMLPurifier.php | 2 ++ tests/Lexer.php | 2 ++ tests/index.php | 9 --------- 11 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Definition.php b/Definition.php index e0a17fd5..e64ba925 100644 --- a/Definition.php +++ b/Definition.php @@ -1,5 +1,10 @@ lexer->tokenizeHTML($html); $tokens = $this->definition->purifyTokens($tokens); return $this->generator->generateFromTokens($tokens); - } } diff --git a/Lexer.php b/Lexer.php index b83b2458..0232d9a3 100644 --- a/Lexer.php +++ b/Lexer.php @@ -12,6 +12,8 @@ TODO: */ +require_once 'HTMLPurifier/Token.php'; + class HTMLPurifier_Lexer { diff --git a/TODO.txt b/TODO.txt index e7f47ca4..ec6758f2 100644 --- a/TODO.txt +++ b/TODO.txt @@ -6,7 +6,6 @@ Primary: Secondary: - Build an automated release system that will create minimal versions too - Build system that will in-line includes -- Set up the file includes - Migrate all unit tests to use the lexer and generator - Build the entity lookup table diff --git a/benchmarks/HTML_Lexer.php b/benchmarks/HTML_Lexer.php index 52ce2ee9..105b3156 100644 --- a/benchmarks/HTML_Lexer.php +++ b/benchmarks/HTML_Lexer.php @@ -4,13 +4,15 @@ set_time_limit(5); +// emulates inserting a dir called HTMLPurifier into your class dir +set_include_path(get_include_path() . PATH_SEPARATOR . '../../'); + // PEAR require_once 'Benchmark/Timer.php'; require_once 'XML/HTMLSax3.php'; require_once 'Text/Password.php'; -require_once '../Token.php'; -require_once '../Lexer.php'; +require_once 'HTMLPurifier/Lexer.php'; class TinyTimer extends Benchmark_Timer { diff --git a/tests/ChildDef.php b/tests/ChildDef.php index a46147ea..ea9a21c9 100644 --- a/tests/ChildDef.php +++ b/tests/ChildDef.php @@ -1,5 +1,9 @@ addTestFile('HTMLPurifier.php');