2006-08-05 02:16:28 +00:00
|
|
|
<?php
|
|
|
|
|
2006-10-21 17:27:51 +00:00
|
|
|
// todo: change testing harness from accepting arrays to
|
|
|
|
// have one call per test
|
|
|
|
|
2006-08-05 02:16:28 +00:00
|
|
|
class HTMLPurifier_AttrTransformHarness extends UnitTestCase
|
|
|
|
{
|
|
|
|
|
|
|
|
var $transform;
|
|
|
|
|
2006-10-21 17:27:51 +00:00
|
|
|
function assertTransform($inputs, $expect, $config = array(), $context = array()) {
|
2006-08-14 23:11:28 +00:00
|
|
|
$default_config = HTMLPurifier_Config::createDefault();
|
2006-10-21 17:27:51 +00:00
|
|
|
$default_context = new HTMLPurifier_Context();
|
2006-08-05 02:16:28 +00:00
|
|
|
foreach ($inputs as $i => $input) {
|
2006-08-14 23:11:28 +00:00
|
|
|
if (!isset($config[$i])) $config[$i] = $default_config;
|
2006-10-21 17:27:51 +00:00
|
|
|
if (!isset($context[$i])) $context[$i] = $default_context;
|
|
|
|
$result = $this->transform->transform($input, $config[$i], $context[$i]);
|
2006-08-14 23:11:28 +00:00
|
|
|
if ($expect[$i] === true) $expect[$i] = $input;
|
|
|
|
$this->assertEqual($expect[$i], $result, "Test $i: %s");
|
2006-08-05 02:16:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|