1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-05 05:37:49 +02:00

Convert HTMLPurifier_Config to use property list backend.

Signed-off-by: Edward Z. Yang <edwardzyang@thewritingpot.com>
This commit is contained in:
Edward Z. Yang
2009-02-02 18:42:23 -05:00
parent b31f280d41
commit b9094d5ec8
6 changed files with 71 additions and 36 deletions

View File

@@ -65,23 +65,29 @@ class HTMLPurifier_PropertyListTest extends UnitTestCase
$this->assertIdentical($plist->has('key3'), false);
}
function testIterator() {
$plist = new HTMLPurifier_PropertyList();
$plist->set('nkey1', 'v');
$plist->set('nkey2', 'v');
$plist->set('rkey3', 'v');
$a = array();
foreach ($plist->getIterator() as $key => $value) {
$a[$key] = $value;
}
$this->assertIdentical($a, array('nkey1' => 'v', 'nkey2' => 'v', 'rkey3' => 'v'));
$a = array();
foreach ($plist->getIterator('nkey') as $key => $value) {
$a[$key] = $value;
}
$this->assertIdentical($a, array('nkey1' => 'v', 'nkey2' => 'v'));
function testSquash() {
$parent = new HTMLPurifier_PropertyList();
$parent->set('key1', 'hidden');
$parent->set('key2', 2);
$plist = new HTMLPurifier_PropertyList($parent);
$plist->set('key1', 1);
$plist->set('key3', 3);
$this->assertIdentical(
$plist->squash(),
array('key1' => 1, 'key2' => 2, 'key3' => 3)
);
// updates don't show up...
$plist->set('key2', 22);
$this->assertIdentical(
$plist->squash(),
array('key1' => 1, 'key2' => 2, 'key3' => 3)
);
// until you force
$this->assertIdentical(
$plist->squash(true),
array('key1' => 1, 'key2' => 22, 'key3' => 3)
);
}
}
// vim: et sw=4 sts=4