0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-09 15:28:40 +00:00
htmlpurifier/tests/HTMLPurifier/AttrTransformTest.php
Marcus Bointon fac747bdbd PSR-2 reformatting PHPDoc corrections
With minor corrections.

Signed-off-by: Marcus Bointon <marcus@synchromedia.co.uk>
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
2013-08-17 22:27:26 -04:00

46 lines
1.3 KiB
PHP

<?php
Mock::generatePartial(
'HTMLPurifier_AttrTransform',
'HTMLPurifier_AttrTransformTestable',
array('transform'));
class HTMLPurifier_AttrTransformTest extends HTMLPurifier_Harness
{
public function test_prependCSS()
{
$t = new HTMLPurifier_AttrTransformTestable();
$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);
}
public function test_confiscateAttr()
{
$t = new HTMLPurifier_AttrTransformTestable();
$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);
}
}
// vim: et sw=4 sts=4