mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-08 14:58:42 +00:00
43f01925cd
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1458 48356398-32a2-884e-a903-53898d9a118a
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
require_once 'HTMLPurifier/AttrTransform.php';
|
|
|
|
Mock::generatePartial(
|
|
'HTMLPurifier_AttrTransform',
|
|
'HTMLPurifier_AttrTransformTestable',
|
|
array('transform'));
|
|
|
|
class HTMLPurifier_AttrTransformTest extends HTMLPurifier_Harness
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|