mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-03 20:58:11 +02:00
[2.1.4] [MFH] Revamp URI handling of percent encoding and validation from r1709
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/php4@1721 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -37,5 +37,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