From 3baf1774b29628f26e00280701f38ba8077920b1 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 27 Jan 2008 19:59:12 +0000 Subject: [PATCH] [3.1.0] Initial commit of adapter functionality; not complete. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1524 48356398-32a2-884e-a903-53898d9a118a --- extras/ConfigSchema/StringHashAdapter.php | 22 ++++++++++++ tests/ConfigSchema/StringHashAdapterTest.php | 35 ++++++++++++++++++++ tests/test_files.php | 1 + 3 files changed, 58 insertions(+) create mode 100644 extras/ConfigSchema/StringHashAdapter.php create mode 100644 tests/ConfigSchema/StringHashAdapterTest.php diff --git a/extras/ConfigSchema/StringHashAdapter.php b/extras/ConfigSchema/StringHashAdapter.php new file mode 100644 index 00000000..d1098f30 --- /dev/null +++ b/extras/ConfigSchema/StringHashAdapter.php @@ -0,0 +1,22 @@ +add($ns, $directive, $default, $type, $description); + } + +} diff --git a/tests/ConfigSchema/StringHashAdapterTest.php b/tests/ConfigSchema/StringHashAdapterTest.php new file mode 100644 index 00000000..087d6099 --- /dev/null +++ b/tests/ConfigSchema/StringHashAdapterTest.php @@ -0,0 +1,35 @@ + $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" + ) + ) + ); + } +} diff --git a/tests/test_files.php b/tests/test_files.php index dec38e1b..73527851 100644 --- a/tests/test_files.php +++ b/tests/test_files.php @@ -136,4 +136,5 @@ $test_files[] = 'FSTools/FileTest.php'; // ConfigSchema auxiliary library +$test_files[] = 'ConfigSchema/StringHashAdapterTest.php'; $test_files[] = 'ConfigSchema/StringHashParserTest.php';