1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-11 00:24:03 +02:00

[1.2.0] Migrate AttrTransform tests to use the Harness supertype.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@496 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-10-22 03:38:32 +00:00
parent 7d2fe4c5d7
commit 8256ca4376
5 changed files with 99 additions and 92 deletions

View File

@@ -1,23 +1,12 @@
<?php
// todo: change testing harness from accepting arrays to
// have one call per test
require_once 'HTMLPurifier/Harness.php';
class HTMLPurifier_AttrTransformHarness extends UnitTestCase
class HTMLPurifier_AttrTransformHarness extends HTMLPurifier_Harness
{
var $transform;
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;
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");
}
function setUp() {
$this->func = 'transform';
}
}