2006-07-23 00:11:03 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
|
2006-08-02 02:24:03 +00:00
|
|
|
// wishlist: automated calling of this file from multiple PHP versions so we
|
|
|
|
// don't have to constantly switch around
|
|
|
|
|
2006-08-01 00:18:22 +00:00
|
|
|
// load files, assume that simpletest directory is in path
|
2006-07-23 00:11:03 +00:00
|
|
|
require_once 'simpletest/unit_tester.php';
|
|
|
|
require_once 'simpletest/reporter.php';
|
|
|
|
require_once 'simpletest/mock_objects.php';
|
|
|
|
|
|
|
|
require_once 'Debugger.php';
|
|
|
|
|
|
|
|
// emulates inserting a dir called HTMLPurifier into your class dir
|
|
|
|
set_include_path(get_include_path() . PATH_SEPARATOR . '../library');
|
|
|
|
|
2006-07-29 17:38:28 +00:00
|
|
|
// since Mocks can't be called from within test files, we need to do
|
|
|
|
// a little jumping through hoops to generate them
|
|
|
|
function generate_mock_once($name) {
|
|
|
|
$mock_name = $name . 'Mock';
|
|
|
|
if (class_exists($mock_name)) return false;
|
|
|
|
Mock::generate($name, $mock_name);
|
|
|
|
}
|
|
|
|
|
2006-08-05 02:28:35 +00:00
|
|
|
// define callable test files
|
|
|
|
$test_files = array();
|
|
|
|
$test_files[] = 'LexerTest.php';
|
|
|
|
$test_files[] = 'Lexer/DirectLexTest.php';
|
|
|
|
//$test_files[] = 'TokenTest.php';
|
|
|
|
$test_files[] = 'ChildDefTest.php';
|
|
|
|
$test_files[] = 'GeneratorTest.php';
|
|
|
|
$test_files[] = 'EntityLookupTest.php';
|
|
|
|
$test_files[] = 'Strategy/RemoveForeignElementsTest.php';
|
|
|
|
$test_files[] = 'Strategy/MakeWellFormedTest.php';
|
|
|
|
$test_files[] = 'Strategy/FixNestingTest.php';
|
|
|
|
$test_files[] = 'Strategy/CompositeTest.php';
|
|
|
|
$test_files[] = 'Strategy/CoreTest.php';
|
|
|
|
$test_files[] = 'Strategy/ValidateAttributesTest.php';
|
|
|
|
$test_files[] = 'AttrDefTest.php';
|
|
|
|
$test_files[] = 'AttrDef/EnumTest.php';
|
|
|
|
$test_files[] = 'AttrDef/IDTest.php';
|
|
|
|
$test_files[] = 'AttrDef/ClassTest.php';
|
|
|
|
$test_files[] = 'AttrDef/TextTest.php';
|
|
|
|
$test_files[] = 'AttrDef/LangTest.php';
|
2006-08-06 01:03:48 +00:00
|
|
|
$test_files[] = 'AttrDef/PixelsTest.php';
|
2006-08-05 02:28:35 +00:00
|
|
|
$test_files[] = 'IDAccumulatorTest.php';
|
|
|
|
$test_files[] = 'TagTransformTest.php';
|
|
|
|
$test_files[] = 'AttrTransform/LangTest.php';
|
2006-08-05 02:56:57 +00:00
|
|
|
$test_files[] = 'AttrTransform/TextAlignTest.php';
|
2006-08-05 02:28:35 +00:00
|
|
|
|
2006-08-06 01:03:48 +00:00
|
|
|
|
2006-08-05 02:28:35 +00:00
|
|
|
$test_file_lookup = array_flip($test_files);
|
|
|
|
|
|
|
|
if (isset($_GET['file']) && isset($test_file_lookup[$_GET['file']])) {
|
|
|
|
|
|
|
|
// execute only one test
|
|
|
|
$test_file = $_GET['file'];
|
|
|
|
|
|
|
|
$test = new GroupTest('HTMLPurifier - ' . $test_file);
|
|
|
|
$test->addTestFile('HTMLPurifier/' . $test_file);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$test = new GroupTest('HTMLPurifier');
|
|
|
|
|
|
|
|
foreach ($test_files as $test_file) {
|
|
|
|
$test->addTestFile('HTMLPurifier/' . $test_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2006-07-23 00:11:03 +00:00
|
|
|
|
2006-08-01 00:18:22 +00:00
|
|
|
if (SimpleReporter::inCli()) $reporter = new TextReporter();
|
|
|
|
else $reporter = new HTMLReporter();
|
|
|
|
|
|
|
|
$test->run($reporter);
|
2006-07-23 00:11:03 +00:00
|
|
|
|
2006-07-21 23:27:00 +00:00
|
|
|
?>
|