mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 16:31:53 +00:00
d5e75f2616
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@174 48356398-32a2-884e-a903-53898d9a118a
80 lines
2.5 KiB
PHP
80 lines
2.5 KiB
PHP
<?php
|
|
|
|
error_reporting(E_ALL);
|
|
|
|
// wishlist: automated calling of this file from multiple PHP versions so we
|
|
// don't have to constantly switch around
|
|
|
|
// load files, assume that simpletest directory is in path
|
|
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');
|
|
|
|
// 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);
|
|
}
|
|
|
|
// 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';
|
|
$test_files[] = 'AttrDef/PixelsTest.php';
|
|
$test_files[] = 'AttrDef/LengthTest.php';
|
|
$test_files[] = 'AttrDef/NumberSpanTest.php';
|
|
$test_files[] = 'IDAccumulatorTest.php';
|
|
$test_files[] = 'TagTransformTest.php';
|
|
$test_files[] = 'AttrTransform/LangTest.php';
|
|
$test_files[] = 'AttrTransform/TextAlignTest.php';
|
|
|
|
|
|
$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);
|
|
}
|
|
|
|
}
|
|
|
|
if (SimpleReporter::inCli()) $reporter = new TextReporter();
|
|
else $reporter = new HTMLReporter();
|
|
|
|
$test->run($reporter);
|
|
|
|
?>
|