From a65cb1b4fc810172792806978dc743ce0edc43fe Mon Sep 17 00:00:00 2001 From: geekwright Date: Thu, 16 Feb 2017 17:38:48 -0600 Subject: [PATCH] Add test --- tests/RegisteredDomainTest.php | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/RegisteredDomainTest.php b/tests/RegisteredDomainTest.php index 77940c7..9ea120a 100644 --- a/tests/RegisteredDomainTest.php +++ b/tests/RegisteredDomainTest.php @@ -1,6 +1,18 @@ decodePunycode($string); + } +} + class RegisteredDomainTest extends \PHPUnit_Framework_TestCase { /** @@ -144,4 +156,32 @@ public function domainsProvider() ); return $provider; } + + /** + * @covers Geekwright\RegDom\RegisteredDomain::getRegisteredDomain + * + * @dataProvider punycodeProvider + */ + public function testDecodePunycode($punycode, $decoded) + { + $object = new TestProtectedDecodePunycode(); + $this->assertEquals($decoded, $object->doDecodePunycode($punycode)); + } + + /** + * @return array + */ + public function punycodeProvider() + { + $provider = array( + array(null, null), + // Mixed case. + array('test', 'test'), + // punycoded + array('xn--85x722f', '食狮'), + array('xn--55qx5d', '公司'), + array('xn--fiqs8s', '中国'), + ); + return $provider; + } }