1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-01 11:50:28 +02:00

Refactor unit tests so that abstract test cases are now called Harnesses and AttrDef tests use their harness's assertDef() function, which enforces type much better. Also fixed a few bugs.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@161 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-05 00:30:31 +00:00
parent 6232221c08
commit 1945ddca5c
16 changed files with 100 additions and 70 deletions

View File

@@ -0,0 +1,24 @@
<?php
class HTMLPurifier_AttrDefHarness extends UnitTestCase
{
var $def;
var $id_accumulator;
var $config;
// cannot be used for accumulator
function assertDef($string, $expect = true) {
// $expect can be a string or bool
if (!$this->config) $this->config = HTMLPurifier_Config::createDefault();
$result = $this->def->validate($string, $this->config, $this->id_accumulator);
if ($expect === true) {
$this->assertIdentical($string, $result);
} else {
$this->assertIdentical($expect, $result);
}
}
}
?>