3 class ConfigSchema_StringHashAdapterTest
extends UnitTestCase
5 function __construct() {
6 generate_mock_once('HTMLPurifier_ConfigSchema');
7 parent
::UnitTestCase();
10 function assertAdapt($input, $calls = array()) {
11 $schema = new HTMLPurifier_ConfigSchemaMock();
12 foreach ($calls as $func => $params) {
13 $schema->expectOnce($func, $params);
15 $adapter = new ConfigSchema_StringHashAdapter();
16 $adapter->adapt($input, $schema);
19 function testBasic() {
22 'ID' => 'Namespace.Directive',
23 'DEFAULT' => "'default' . 'bar'",
25 'DESCRIPTION' => "Description of default.\n",
29 'Namespace', 'Directive', 'defaultbar', 'string',
30 "Description of default.\n"
36 function testNamespace() {
40 'DESCRIPTION' => 'Description of namespace'
43 'addNamespace' => array('Namespace', 'Description of namespace'),
48 function testMissingId() {
49 $this->expectError('Missing key ID in string hash');
50 $this->assertAdapt(array());