1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-04 05:07:55 +02:00

[1.4.0] Revamp ConfigTest.php. Factor out tallyErrors() to its own function.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@671 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-01-21 04:37:02 +00:00
parent 2293c67eec
commit f7f6fed86a
4 changed files with 174 additions and 99 deletions

View File

@@ -2,7 +2,9 @@
require_once 'HTMLPurifier/ConfigSchema.php';
class CS extends HTMLPurifier_ConfigSchema {} // alias for less keystrokes
if (!class_exists('CS')) {
class CS extends HTMLPurifier_ConfigSchema {}
}
class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
{
@@ -39,22 +41,7 @@ class HTMLPurifier_ConfigSchemaTest extends UnitTestCase
function tearDown() {
// testing is done, restore the old copy
HTMLPurifier_ConfigSchema::instance($this->old_copy);
$this->tallyErrors();
}
function tallyErrors() {
// BRITTLE: relies on private code to work
$context = &SimpleTest::getContext();
$queue = &$context->get('SimpleErrorQueue');
if (!isset($queue->_expectation_queue)) return; // fut-compat
foreach ($queue->_expectation_queue as $e) {
if (count($e) != 2) return; // fut-compat
if (!isset($e[0])) return; // fut-compat
$e[0]->_dumper = &new SimpleDumper();
$this->fail('Error expectation not fulfilled: ' .
$e[0]->testMessage(null));
}
$queue->_expectation_queue = array();
tally_errors();
}
function test_defineNamespace() {