1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 19:30:21 +02:00

Support dry runs in SimpleTest, as well as misc other improvements.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1514 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2008-01-21 20:27:26 +00:00
parent c9bf2e8489
commit 25551c4b78
5 changed files with 34 additions and 11 deletions

View File

@@ -34,8 +34,8 @@ if (!SimpleReporter::inCli()) {
$AC = array(); // parameters
$AC['exclude-normal'] = false;
$AC['exclude-standalone'] = false;
$AC['file'] = '';
$AC['xml'] = false;
$AC['file'] = '';
$AC['xml'] = false;
$AC['quiet'] = false;
$aliases = array(
'f' => 'file',
@@ -48,9 +48,10 @@ shell_exec('php ../maintenance/flush-definition-cache.php');
$test = new TestSuite('HTML Purifier Multiple Versions Test');
$file = '';
$test_files = array();
require 'test_files.php';
if ($AC['file']) {
$test_files = array();
require 'test_files.php';
$test_files_lookup = array_flip($test_files);
if (isset($test_files_lookup[$AC['file']])) {
$file = '--file=' . $AC['file'];
@@ -59,16 +60,23 @@ if ($AC['file']) {
exit;
}
}
// This allows us to get out of having to do dry runs.
$size = count($test_files);
foreach ($versions_to_test as $version) {
$flush = '';
if (is_array($version)) {
$version = $version[0];
$flush = '--flush';
}
if (!$AC['exclude-normal']) $test->addTestCase(new CliTestCase("$phpv $version index.php --xml $flush $file", $AC['quiet']));
if (!$AC['exclude-standalone']) $test->addTestCase(new CliTestCase("$phpv $version index.php --xml --standalone $file", $AC['quiet']));
if (!$AC['exclude-normal']) $test->addTestCase(new CliTestCase("$phpv $version index.php --xml $flush $file", $AC['quiet'], $size));
if (!$AC['exclude-standalone']) $test->addTestCase(new CliTestCase("$phpv $version index.php --xml --standalone $file", $AC['quiet'], $size));
}
// This is the HTML Purifier website's test XML file. We could
// add more websites, i.e. more configurations to test.
$test->addTestCase(new RemoteTestCase('http://localhost/htmlpurifier/tests/?xml', 'http://localhost/htmlpurifier/tests/?xml&dry'));
if ($AC['xml']) {
$reporter = new XmlReporter();
} else {