mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-30 19:00:10 +02:00
[3.1.0] Revamp URI handling of percent encoding and validation.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1709 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -35,5 +35,28 @@ class HTMLPurifier_PercentEncoderTest extends HTMLPurifier_Harness
|
||||
|
||||
}
|
||||
|
||||
function assertEncode($string, $expect = true, $preserve = false) {
|
||||
if ($expect === true) $expect = $string;
|
||||
$encoder = new HTMLPurifier_PercentEncoder($preserve);
|
||||
$result = $encoder->encode($string);
|
||||
$this->assertIdentical($result, $expect);
|
||||
}
|
||||
|
||||
function test_encode_noChange() {
|
||||
$this->assertEncode('abc012-_~.');
|
||||
}
|
||||
|
||||
function test_encode_encode() {
|
||||
$this->assertEncode('>', '%3E');
|
||||
}
|
||||
|
||||
function test_encode_preserve() {
|
||||
$this->assertEncode('<>', '<%3E', '<');
|
||||
}
|
||||
|
||||
function test_encode_low() {
|
||||
$this->assertEncode("\1", '%01');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user