Release 1.6.1, merged in 931 to HEAD.
[htmlpurifier.git] / tests / HTMLPurifier / AttrTransformTest.php
blobfac016332f08c8276e35674081353724b2caa07f
1 <?php
3 require_once 'HTMLPurifier/AttrTransform.php';
5 class HTMLPurifier_AttrTransformTest extends UnitTestCase
8 function test_prependCSS() {
10 $t = new HTMLPurifier_AttrTransform();
12 $attr = array();
13 $t->prependCSS($attr, 'style:new;');
14 $this->assertIdentical(array('style' => 'style:new;'), $attr);
16 $attr = array('style' => 'style:original;');
17 $t->prependCSS($attr, 'style:new;');
18 $this->assertIdentical(array('style' => 'style:new;style:original;'), $attr);
20 $attr = array('style' => 'style:original;', 'misc' => 'un-related');
21 $t->prependCSS($attr, 'style:new;');
22 $this->assertIdentical(array('style' => 'style:new;style:original;', 'misc' => 'un-related'), $attr);
26 function test_confiscateAttr() {
28 $t = new HTMLPurifier_AttrTransform();
30 $attr = array('flavor' => 'sweet');
31 $this->assertIdentical('sweet', $t->confiscateAttr($attr, 'flavor'));
32 $this->assertIdentical(array(), $attr);
34 $attr = array('flavor' => 'sweet');
35 $this->assertIdentical(null, $t->confiscateAttr($attr, 'color'));
36 $this->assertIdentical(array('flavor' => 'sweet'), $attr);