- Implement StringHash wrapper ArrayObject
[htmlpurifier/bfroehle.git] / tests / ConfigSchema / StringHashAdapterTest.php
blobd29bc34722bda41c1459eac7fb29d1b0beda1027
1 <?php
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() {
20 $this->assertAdapt(
21 array(
22 'ID' => 'Namespace.Directive',
23 'DEFAULT' => "'default' . 'bar'",
24 'TYPE' => 'string',
25 'DESCRIPTION' => "Description of default.\n",
27 array(
28 'add' => array(
29 'Namespace', 'Directive', 'defaultbar', 'string',
30 "Description of default.\n"
36 function testNamespace() {
37 $this->assertAdapt(
38 array(
39 'ID' => 'Namespace',
40 'DESCRIPTION' => 'Description of namespace'
42 array(
43 'addNamespace' => array('Namespace', 'Description of namespace'),
48 function testMissingId() {
49 $this->expectError('Missing key ID in string hash');
50 $this->assertAdapt(array());