1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-31 03:10:09 +02:00

Various improvements to test script command line options, i.e. --type

The following changes were made:
* Create --type parameter which accepts 'htmlpurifier', 'phpt', 'vtest', etc.
  in order to execute only that class of tests. This supercedes --only-phpt.
* Create --quick parameter for multitest.php, run only the tips of each
  release series.
* Create --distro parameter for multitest.php, supercedes --exclude-normal
  and --exclude-standalone.

Also, a grep for htmlt tests was added, although add_tests() doesn't do
anything with it yet.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2008-07-05 02:25:40 -04:00
parent a227cb483a
commit 334ffac5b4
4 changed files with 135 additions and 76 deletions

View File

@@ -11,6 +11,8 @@
* - file (f), a single file to test
* - xml, whether or not to output XML
* - dry, whether or not to do a dry run
* - type, the type of tests to run, can be 'htmlpurifier', 'configdoc',
* 'fstools', 'htmlt', 'vtest' or 'phpt'
*
* If you're interested in running the test-cases, mosey over to
* ../test-settings.sample.php, copy the file to test-settings.php and follow
@@ -38,10 +40,9 @@ $AC['xml'] = false;
$AC['dry'] = false;
$AC['php'] = $php;
// Convenience parameters for running quicker tests; ideally all tests
// should be performed.
$AC['type'] = '';
$AC['disable-phpt'] = false;
$AC['only-phpt'] = false;
$AC['only-phpt'] = false; // alias for --type=phpt
$aliases = array(
'f' => 'file',
@@ -52,18 +53,18 @@ $aliases = array(
htmlpurifier_parse_args($AC, $aliases);
// Disable PHPT tests if they're not enabled
if (!$GLOBALS['HTMLPurifierTest']['PHPT']) $AC['disable-phpt'] = true;
if (!$GLOBALS['HTMLPurifierTest']['PHPT']) {
$AC['disable-phpt'] = true;
} elseif (!$AC['type'] && $AC['only-phpt']) {
// backwards-compat
$AC['type'] = 'phpt';
}
if (!SimpleReporter::inCli()) {
// Undo any dangerous parameters
$AC['php'] = $php;
}
if ($AC['disable-phpt'] && $AC['only-phpt']) {
echo "Cannot disable and allow only PHPT tests!\n";
exit(1);
}
// Shell-script code is executed
if ($AC['xml']) {
@@ -102,14 +103,7 @@ if (!$AC['disable-phpt']) {
}
// load tests
$test_files = array();
$test_dirs = array();
$test_dirs_exclude = array();
$vtest_dirs = array();
$phpt_dirs = array();
require 'test_files.php'; // populates $test_files array
require 'test_files.php';
$FS = new FSTools();
@@ -139,6 +133,14 @@ foreach ($phpt_dirs as $dir) {
}
}
// handle htmlt dirs
foreach ($htmlt_dirs as $dir) {
$htmlt_files = $FS->globr($dir, '*.htmlt');
foreach ($htmlt_files as $file) {
$test_files[] = str_replace('\\', '/', $file);
}
}
array_unique($test_files);
sort($test_files); // for the SELECT
$GLOBALS['HTMLPurifierTest']['Files'] = $test_files; // for the reporter