0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-23 17:01:51 +00:00
htmlpurifier/tests/ConfigSchema/StringHashAdapterTest.php

36 lines
1018 B
PHP
Raw Normal View History

<?php
class ConfigSchema_StringHashAdapterTest extends UnitTestCase
{
function __construct() {
generate_mock_once('HTMLPurifier_ConfigSchema');
parent::UnitTestCase();
}
function assertAdapt($input, $calls) {
$schema = new HTMLPurifier_ConfigSchemaMock();
foreach ($calls as $func => $params) {
$schema->expectOnce($func, $params);
}
$adapter = new ConfigSchema_StringHashAdapter();
$adapter->adapt($input, $schema);
}
function testBasic() {
$this->assertAdapt(
array(
'ID' => 'Namespace.Directive',
'DEFAULT' => "'default' . 'bar'",
'TYPE' => 'string',
'DESCRIPTION' => "Description of default.\n",
),
array(
'add' => array(
'Namespace', 'Directive', 'defaultbar', 'string',
"Description of default.\n"
)
)
);
}
}