diff --git a/benchmarks/Lexer.php b/benchmarks/Lexer.php index d515a230..2d02defb 100644 --- a/benchmarks/Lexer.php +++ b/benchmarks/Lexer.php @@ -3,15 +3,22 @@ // emulates inserting a dir called HTMLPurifier into your class dir set_include_path(get_include_path() . PATH_SEPARATOR . '../library/'); +require_once '../test-settings.php'; + require_once 'HTMLPurifier/ConfigSchema.php'; require_once 'HTMLPurifier/Config.php'; -require_once 'HTMLPurifier/Lexer/DirectLex.php'; -require_once 'HTMLPurifier/Lexer/PEARSax3.php'; -$LEXERS = array( - 'DirectLex' => new HTMLPurifier_Lexer_DirectLex(), - 'PEARSax3' => new HTMLPurifier_Lexer_PEARSax3() -); +$LEXERS = array(); + +require_once 'HTMLPurifier/Lexer/DirectLex.php'; +$LEXERS['DirectLex'] = new HTMLPurifier_Lexer_DirectLex(); + +if (!empty($GLOBALS['HTMLPurifierTest']['PEAR'])) { + require_once 'HTMLPurifier/Lexer/PEARSax3.php'; + $LEXERS['PEARSax3'] = new HTMLPurifier_Lexer_PEARSax3(); +} else { + exit('PEAR required to perform benchmark.'); +} if (version_compare(PHP_VERSION, '5', '>=')) { require_once 'HTMLPurifier/Lexer/DOMLex.php';