2006-08-05 00:30:31 +00:00
|
|
|
<?php
|
|
|
|
|
2007-08-01 14:06:59 +00:00
|
|
|
class HTMLPurifier_AttrDefHarness extends HTMLPurifier_Harness
|
2006-08-05 00:30:31 +00:00
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
protected $def;
|
|
|
|
protected $context, $config;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2006-10-21 18:18:36 +00:00
|
|
|
$this->config = HTMLPurifier_Config::createDefault();
|
|
|
|
$this->context = new HTMLPurifier_Context();
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
// cannot be used for accumulator
|
2016-10-27 08:54:35 +00:00
|
|
|
public function assertDef($string, $expect = true, $or_false = false)
|
2013-07-16 11:56:14 +00:00
|
|
|
{
|
2006-08-05 00:30:31 +00:00
|
|
|
// $expect can be a string or bool
|
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) {
|
2016-10-27 08:54:35 +00:00
|
|
|
if (!($or_false && $result === false)) {
|
|
|
|
$this->assertIdentical($string, $result);
|
|
|
|
}
|
2006-08-05 00:30:31 +00:00
|
|
|
} else {
|
2016-10-27 08:54:35 +00:00
|
|
|
if (!($or_false && $result === false)) {
|
|
|
|
$this->assertIdentical($expect, $result);
|
|
|
|
}
|
2006-08-05 00:30:31 +00:00
|
|
|
}
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2006-08-05 00:30:31 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|