mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-01 11:50:28 +02:00
[1.2.0]
- Add context parameter to AttrTransform objects. - Update documentation on attribute transformations in ValidateAttributes.php git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@493 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
<?php
|
||||
|
||||
// todo: change testing harness from accepting arrays to
|
||||
// have one call per test
|
||||
|
||||
class HTMLPurifier_AttrTransformHarness extends UnitTestCase
|
||||
{
|
||||
|
||||
var $transform;
|
||||
|
||||
function assertTransform($inputs, $expect, $config = array()) {
|
||||
function assertTransform($inputs, $expect, $config = array(), $context = array()) {
|
||||
$default_config = HTMLPurifier_Config::createDefault();
|
||||
$default_context = new HTMLPurifier_Context();
|
||||
foreach ($inputs as $i => $input) {
|
||||
if (!isset($config[$i])) $config[$i] = $default_config;
|
||||
$result = $this->transform->transform($input, $config[$i]);
|
||||
if (!isset($context[$i])) $context[$i] = $default_context;
|
||||
$result = $this->transform->transform($input, $config[$i], $context[$i]);
|
||||
if ($expect[$i] === true) $expect[$i] = $input;
|
||||
$this->assertEqual($expect[$i], $result, "Test $i: %s");
|
||||
}
|
||||
|
Reference in New Issue
Block a user