From 79c18eb78156fe95f922aad21ce2c35cdb433a4f Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sat, 4 Aug 2007 14:51:06 +0000 Subject: [PATCH] [2.1.1] Single test methods can be invoked by prefixing them with __only git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1363 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 1 + tests/HTMLPurifier/Harness.php | 10 ++++++++++ tests/HTMLPurifierTest.php | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c8610a8b..d5b82b55 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Fix show-stopper bug in %URI.MakeAbsolute functionality . Add prefix directory to include path for standalone, this prevents other installations from clobbering the standalone's URI schemes +. Single test methods can be invoked by prefixing with __only 2.1.0, released 2007-08-02 # flush-htmldefinition-cache.php superseded in favor of a generic diff --git a/tests/HTMLPurifier/Harness.php b/tests/HTMLPurifier/Harness.php index 897a9f23..4af4384b 100644 --- a/tests/HTMLPurifier/Harness.php +++ b/tests/HTMLPurifier/Harness.php @@ -55,5 +55,15 @@ class HTMLPurifier_Harness extends UnitTestCase } } + function getTests() { + // __onlytest makes only one test get triggered + foreach (get_class_methods(get_class($this)) as $method) { + if (strtolower(substr($method, 0, 10)) == '__onlytest') { + return array($method); + } + } + return parent::getTests(); + } + } diff --git a/tests/HTMLPurifierTest.php b/tests/HTMLPurifierTest.php index 948bae6b..1c5bcd76 100644 --- a/tests/HTMLPurifierTest.php +++ b/tests/HTMLPurifierTest.php @@ -4,7 +4,7 @@ require_once 'HTMLPurifier.php'; // integration test -class HTMLPurifierTest extends UnitTestCase +class HTMLPurifierTest extends HTMLPurifier_Harness { var $purifier;