2007-05-05 02:25:55 +00:00
|
|
|
<?php
|
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
Mock::generatePartial(
|
|
|
|
'HTMLPurifier_AttrTransform',
|
|
|
|
'HTMLPurifier_AttrTransformTestable',
|
|
|
|
array('transform'));
|
|
|
|
|
2007-08-01 14:06:59 +00:00
|
|
|
class HTMLPurifier_AttrTransformTest extends HTMLPurifier_Harness
|
2007-05-05 02:25:55 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
function test_prependCSS() {
|
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
$t = new HTMLPurifier_AttrTransformTestable();
|
2007-05-05 02:25:55 +00:00
|
|
|
|
|
|
|
$attr = array();
|
|
|
|
$t->prependCSS($attr, 'style:new;');
|
|
|
|
$this->assertIdentical(array('style' => 'style:new;'), $attr);
|
|
|
|
|
|
|
|
$attr = array('style' => 'style:original;');
|
|
|
|
$t->prependCSS($attr, 'style:new;');
|
|
|
|
$this->assertIdentical(array('style' => 'style:new;style:original;'), $attr);
|
|
|
|
|
|
|
|
$attr = array('style' => 'style:original;', 'misc' => 'un-related');
|
|
|
|
$t->prependCSS($attr, 'style:new;');
|
|
|
|
$this->assertIdentical(array('style' => 'style:new;style:original;', 'misc' => 'un-related'), $attr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_confiscateAttr() {
|
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
$t = new HTMLPurifier_AttrTransformTestable();
|
2007-05-05 02:25:55 +00:00
|
|
|
|
|
|
|
$attr = array('flavor' => 'sweet');
|
|
|
|
$this->assertIdentical('sweet', $t->confiscateAttr($attr, 'flavor'));
|
|
|
|
$this->assertIdentical(array(), $attr);
|
|
|
|
|
|
|
|
$attr = array('flavor' => 'sweet');
|
|
|
|
$this->assertIdentical(null, $t->confiscateAttr($attr, 'color'));
|
|
|
|
$this->assertIdentical(array('flavor' => 'sweet'), $attr);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|