From fa6b6fe85fdf332c328a1cc479bea8036e077a08 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 2 Mar 2008 02:05:47 +0000 Subject: [PATCH] [3.1.0] Reconfigure tester to glob for test files using *Test.php pattern. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1585 48356398-32a2-884e-a903-53898d9a118a --- tests/HTMLPurifier/AttrDef/HTML/BoolTest.php | 2 +- tests/HTMLPurifier/HTMLModule/ProprietaryTest.php | 2 +- tests/index.php | 20 ++- tests/test_files.php | 187 ++++------------------ 4 files changed, 53 insertions(+), 158 deletions(-) rewrite tests/test_files.php (96%) diff --git a/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php b/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php index 9dfd2962..a82c45b3 100644 --- a/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php +++ b/tests/HTMLPurifier/AttrDef/HTML/BoolTest.php @@ -7,7 +7,7 @@ class HTMLPurifier_AttrDef_HTML_BoolTest extends HTMLPurifier_AttrDefHarness $this->def = new HTMLPurifier_AttrDef_HTML_Bool('foo'); $this->assertDef('foo'); $this->assertDef('', false); - $this->assertDef('bar', false); + $this->assertDef('bar', 'foo'); } function test_make() { diff --git a/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php b/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php index 9aa3e92e..07ad212d 100644 --- a/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php +++ b/tests/HTMLPurifier/HTMLModule/ProprietaryTest.php @@ -18,7 +18,7 @@ class HTMLPurifier_HTMLModule_ProprietaryTest extends HTMLPurifier_HTMLModuleHar scrolldelay="3" scrollamount="5" loop="4" - bgcolor="red" + bgcolor="#FF0000" hspace="5" vspace="3" >
Block
InlineText' diff --git a/tests/index.php b/tests/index.php index 82e81f18..7d94fc26 100755 --- a/tests/index.php +++ b/tests/index.php @@ -86,17 +86,35 @@ if (!$AC['disable-phpt']) { } // load tests + $test_files = array(); +$test_dirs = array(); +$test_dirs_exclude = array(); $phpt_dirs = array(); + require 'test_files.php'; // populates $test_files array + +$FS = new FSTools(); + +// handle test dirs +foreach ($test_dirs as $dir) { + $raw_files = $FS->globr($dir, '*Test.php'); + foreach ($raw_files as $file) { + $file = str_replace('\\', '/', $file); + if (isset($test_dirs_exclude[$file])) continue; + $test_files[] = $file; + } +} + // handle phpt files foreach ($phpt_dirs as $dir) { - $FS = new FSTools(); $phpt_files = $FS->globr($dir, '*.phpt'); foreach ($phpt_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 $test_file_lookup = array_flip($test_files); diff --git a/tests/test_files.php b/tests/test_files.php dissimilarity index 96% index 1c818b31..210112e2 100644 --- a/tests/test_files.php +++ b/tests/test_files.php @@ -1,155 +1,32 @@ -=')) { - $test_files[] = 'ConfigDoc/DOM/DocumentTest.php'; -} - -// FSTools auxiliary library - -$test_files[] = 'FSTools/FileTest.php'; - -} // end if ($AC['only-phpt']) - -// PHPT tests - -if (!$AC['disable-phpt']) { - $phpt_dirs = array(); - $phpt_dirs[] = 'HTMLPurifier/PHPT'; -} +=')) { + $test_dirs[] = 'ConfigDoc'; + } + + // FSTools auxiliary library + $test_dirs[] = 'FSTools'; + +} + +// PHPT tests +if (!$AC['disable-phpt']) { + $phpt_dirs = array(); + $phpt_dirs[] = 'HTMLPurifier/PHPT'; +} -- 2.11.4.GIT