2006-08-05 00:30:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class HTMLPurifier_AttrDefHarness extends UnitTestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
var $def;
|
2006-08-12 16:04:40 +00:00
|
|
|
var $context;
|
2006-08-05 00:30:31 +00:00
|
|
|
var $config;
|
|
|
|
|
2006-10-21 18:18:36 +00:00
|
|
|
function setUp() {
|
|
|
|
$this->config = HTMLPurifier_Config::createDefault();
|
|
|
|
$this->context = new HTMLPurifier_Context();
|
|
|
|
}
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
// cannot be used for accumulator
|
2006-08-12 19:11:21 +00:00
|
|
|
function assertDef($string, $expect = true, $ini = false, $message = '%s') {
|
2006-08-05 00:30:31 +00:00
|
|
|
// $expect can be a string or bool
|
2006-08-12 19:11:21 +00:00
|
|
|
if ($ini) $this->setUpAssertDef();
|
2006-08-12 16:04:40 +00:00
|
|
|
$result = $this->def->validate($string, $this->config, $this->context);
|
2006-08-05 00:30:31 +00:00
|
|
|
if ($expect === true) {
|
2006-08-12 16:32:57 +00:00
|
|
|
$this->assertIdentical($string, $result, $message);
|
2006-08-05 00:30:31 +00:00
|
|
|
} else {
|
2006-08-12 16:32:57 +00:00
|
|
|
$this->assertIdentical($expect, $result, $message);
|
2006-08-05 00:30:31 +00:00
|
|
|
}
|
2006-08-12 19:11:21 +00:00
|
|
|
if ($ini) $this->tearDownAssertDef();
|
2006-08-05 00:30:31 +00:00
|
|
|
}
|
|
|
|
|
2006-08-12 16:32:57 +00:00
|
|
|
function setUpAssertDef() {}
|
|
|
|
function tearDownAssertDef() {}
|
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|