From 8b28e571fe44f11fdbbc907675be334915c5f5d7 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 27 Oct 2016 01:54:35 -0700 Subject: [PATCH] Handle case when IDNAs are supported. Signed-off-by: Edward Z. Yang --- tests/HTMLPurifier/AttrDef/URI/HostTest.php | 2 +- tests/HTMLPurifier/AttrDefHarness.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/HTMLPurifier/AttrDef/URI/HostTest.php b/tests/HTMLPurifier/AttrDef/URI/HostTest.php index 1f20a748..aa8ffc68 100644 --- a/tests/HTMLPurifier/AttrDef/URI/HostTest.php +++ b/tests/HTMLPurifier/AttrDef/URI/HostTest.php @@ -38,7 +38,7 @@ class HTMLPurifier_AttrDef_URI_HostTest extends HTMLPurifier_AttrDefHarness $this->assertDef('f-.top', false); $this->assertDef('1a'); - $this->assertDef("\xE4\xB8\xAD\xE6\x96\x87.com.cn", false); + $this->assertDef("\xE4\xB8\xAD\xE6\x96\x87.com.cn", 'xn--fiq228c.com.cn', true); } diff --git a/tests/HTMLPurifier/AttrDefHarness.php b/tests/HTMLPurifier/AttrDefHarness.php index e2029c04..583cf022 100644 --- a/tests/HTMLPurifier/AttrDefHarness.php +++ b/tests/HTMLPurifier/AttrDefHarness.php @@ -13,14 +13,18 @@ class HTMLPurifier_AttrDefHarness extends HTMLPurifier_Harness } // cannot be used for accumulator - public function assertDef($string, $expect = true) + public function assertDef($string, $expect = true, $or_false = false) { // $expect can be a string or bool $result = $this->def->validate($string, $this->config, $this->context); if ($expect === true) { - $this->assertIdentical($string, $result); + if (!($or_false && $result === false)) { + $this->assertIdentical($string, $result); + } } else { - $this->assertIdentical($expect, $result); + if (!($or_false && $result === false)) { + $this->assertIdentical($expect, $result); + } } } -- 2.11.4.GIT