diff --git a/library/HTMLPurifier/Definition.php b/library/HTMLPurifier/Definition.php new file mode 100644 index 00000000..2a430bde --- /dev/null +++ b/library/HTMLPurifier/Definition.php @@ -0,0 +1,36 @@ +setup) return; + $this->setup = true; + $this->doSetup($config); + } + +} + +?> \ No newline at end of file diff --git a/tests/HTMLPurifier/DefinitionTest.php b/tests/HTMLPurifier/DefinitionTest.php new file mode 100644 index 00000000..2ce85d07 --- /dev/null +++ b/tests/HTMLPurifier/DefinitionTest.php @@ -0,0 +1,33 @@ +expectOnce('doSetup', array($config)); + $def->setup($config); + } + function test_setup_redundant() { + $def = new HTMLPurifier_Definition_Testable(); + $config = HTMLPurifier_Config::createDefault(); + $def->expectNever('doSetup'); + $def->setup = true; + $def->setup($config); + } + function test_doSetup_abstract() { + $def = new HTMLPurifier_Definition(); + $this->expectError('Cannot call abstract method'); + $config = HTMLPurifier_Config::createDefault(); + $def->doSetup($config); + } +} + +?> \ No newline at end of file diff --git a/tests/test_files.php b/tests/test_files.php index af128882..cb184154 100644 --- a/tests/test_files.php +++ b/tests/test_files.php @@ -58,6 +58,7 @@ $test_files[] = 'ChildDef/TableTest.php'; $test_files[] = 'ConfigSchemaTest.php'; $test_files[] = 'ConfigTest.php'; $test_files[] = 'ContextTest.php'; +$test_files[] = 'DefinitionTest.php'; $test_files[] = 'DoctypeRegistryTest.php'; $test_files[] = 'ElementDefTest.php'; $test_files[] = 'EncoderTest.php';