mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
Initial implementation of URISchemeRegistry (fixed overload bug in process). Also, add extra notes to some of the unit tests.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@210 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -5,7 +5,7 @@ require_once 'HTMLPurifier/AttrDef/URI.php';
|
||||
|
||||
// WARNING: INCOMPLETE UNIT TESTS!
|
||||
// we are currently abstaining IPv6 and percent-encode fixing unit tests
|
||||
// as well as recomposition tests
|
||||
// we also need to test all the configuration directives defined by this class
|
||||
|
||||
class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
@@ -15,6 +15,8 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
generate_mock_once('HTMLPurifier_URIScheme');
|
||||
generate_mock_once('HTMLPurifier_URISchemeRegistry');
|
||||
|
||||
$old_registry = HTMLPurifier_URISchemeRegistry::instance();
|
||||
|
||||
// finally, lets get a copy of the actual class
|
||||
$def = new HTMLPurifier_AttrDef_URI();
|
||||
|
||||
@@ -186,6 +188,9 @@ class HTMLPurifier_AttrDef_URITest extends HTMLPurifier_AttrDefHarness
|
||||
|
||||
}
|
||||
|
||||
// reset to regular implementation
|
||||
HTMLPurifier_URISchemeRegistry::instance($old_registry);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -50,6 +50,9 @@ class HTMLPurifier_ConfigDefTest extends UnitTestCase
|
||||
$this->swallowErrors();
|
||||
|
||||
// test overloading already defined value
|
||||
// ACTUALLY, we probably should allow this behavior, which simply
|
||||
// means that two class files need that directive. Using debug_backtrace
|
||||
// we could probably figure which files those are too! :-D
|
||||
HTMLPurifier_ConfigDef::define('Core', 'Name', 89,
|
||||
'What, you\'re not allowed to overload directives? Bummer!');
|
||||
$this->assertError('Cannot redefine directive');
|
||||
|
20
tests/HTMLPurifier/URISchemeRegistryTest.php
Normal file
20
tests/HTMLPurifier/URISchemeRegistryTest.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/URISchemeRegistry.php';
|
||||
|
||||
class HTMLPurifier_URISchemeRegistryTest extends UnitTestCase
|
||||
{
|
||||
|
||||
function test() {
|
||||
|
||||
$registry =& HTMLPurifier_URISchemeRegistry::instance();
|
||||
$this->assertIsA($registry->getScheme('http'), 'HTMLPurifier_URIScheme_http');
|
||||
|
||||
// to come: overloading and custom schemes, as well as changing the
|
||||
// configuration values used by this class
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user