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:
24
tests/HTMLPurifier/AttrDefHarness.php
Normal file
24
tests/HTMLPurifier/AttrDefHarness.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user