mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-07 06:36:44 +02:00
Implement schema extraction script; almost done except for version extraction. Also, some minor refinements.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1534 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -57,4 +57,30 @@ class ConfigSchema_StringHashReverseAdapterTest extends UnitTestCase
|
||||
$adapter->get('BadNs', 'BadDir');
|
||||
}
|
||||
|
||||
function assertMethod($func, $input, $expect) {
|
||||
$adapter = new ConfigSchema_StringHashReverseAdapter($this->makeSchema());
|
||||
$result = $adapter->$func($input);
|
||||
$this->assertIdentical($result, $expect);
|
||||
}
|
||||
|
||||
function testExportEmptyHash() {
|
||||
$this->assertMethod('exportHash', array(), '');
|
||||
}
|
||||
|
||||
function testExportHash() {
|
||||
$this->assertMethod('exportHash', array('foo' => 'bar'), "'foo' => 'bar',\n");
|
||||
}
|
||||
|
||||
function testExportEmptyLookup() {
|
||||
$this->assertMethod('exportLookup', array(), '');
|
||||
}
|
||||
|
||||
function testExportSingleLookup() {
|
||||
$this->assertMethod('exportLookup', array('key' => true), "'key'");
|
||||
}
|
||||
|
||||
function testExportLookup() {
|
||||
$this->assertMethod('exportLookup', array('key' => true, 'key2' => true, 3 => true), "'key', 'key2', 3");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -240,6 +240,7 @@ class HTMLPurifier_ConfigSchemaTest extends HTMLPurifier_Harness
|
||||
$this->assertValid("foo\nbar", 'lookup', array('foo' => true, 'bar' => true));
|
||||
$this->assertValid("foo\nbar,baz", 'lookup', array('foo' => true, 'bar' => true, 'baz' => true));
|
||||
$this->assertValid('', 'lookup', array());
|
||||
$this->assertValid(array(), 'lookup');
|
||||
|
||||
$this->assertValid(array('foo' => 'bar'), 'hash');
|
||||
$this->assertValid(array(1 => 'moo'), 'hash');
|
||||
|
Reference in New Issue
Block a user