diff options
author | mattab <matthieu.aubry@gmail.com> | 2016-08-23 00:22:53 +0300 |
---|---|---|
committer | mattab <matthieu.aubry@gmail.com> | 2016-08-23 00:22:53 +0300 |
commit | 7ca14d216ea95cbce881867a4cb953b367fb7d85 (patch) | |
tree | 8f4cd8644b4d12b90084cb06010e6e09f782e9f4 | |
parent | d83b2b2dd42020dd27a6cf06ad70687aeef42b8f (diff) |
Fix the integration test and patch Zend Validate
-rw-r--r-- | libs/Zend/Validate/Hostname.php | 6 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/EmailValidatorTest.php | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/libs/Zend/Validate/Hostname.php b/libs/Zend/Validate/Hostname.php index 79e9902b6e..1ea9800546 100644 --- a/libs/Zend/Validate/Hostname.php +++ b/libs/Zend/Validate/Hostname.php @@ -492,6 +492,12 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract '微博' => array(1 => self::VALID_UNICODE_DOMAIN), 'ابوظبي' => array(1 => self::VALID_UNICODE_DOMAIN), '网站' => array(1 => self::VALID_UNICODE_DOMAIN), + '大众汽车' => array(1 => self::VALID_UNICODE_DOMAIN), + '香格里拉' => array(1 => self::VALID_UNICODE_DOMAIN), + 'бг' => array(1 => self::VALID_UNICODE_DOMAIN), + '電訊盈科' => array(1 => self::VALID_UNICODE_DOMAIN), + 'العليان' => array(1 => self::VALID_UNICODE_DOMAIN), + '嘉里' => array(1 => self::VALID_UNICODE_DOMAIN), ); diff --git a/tests/PHPUnit/Integration/EmailValidatorTest.php b/tests/PHPUnit/Integration/EmailValidatorTest.php index 75b37e5a60..a9adff114a 100644 --- a/tests/PHPUnit/Integration/EmailValidatorTest.php +++ b/tests/PHPUnit/Integration/EmailValidatorTest.php @@ -42,7 +42,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase private function skipTestIfIdnNotAvailable() { if (!function_exists('idn_to_utf8')) { - $this->markTestSkipped("Couldn't get TLD list"); + $this->markTestSkipped("Function idn_to_utf8 does not exist, skip test"); } } @@ -64,13 +64,18 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase $email = 'test@example.' . $domainNameExtension; if(!$this->isValid($email)) { - $errors[] = "email $email is not valid, but expected to be valid. Add this domain extension to libs/Zend/Validate/Hostname.php"; + $errors[] = $domainNameExtension; } } - // only fail when at least 5 domains are failing the test, so it does not fail every time IANA adds a new domain extension... - if(count($errors) > 5) { - $this->fail( implode(", ", $errors)); + // only fail when at least 10 domains are failing the test, so it does not fail every time IANA adds a new domain extension... + if(count($errors) > 5) + { + $out = ''; + foreach($errors as $domainNameExtension) { + $out .= "\t'$domainNameExtension' => array(1 => self::VALID_UNICODE_DOMAIN),\n"; + } + $this->fail( "Some email extensions are not supported yet, you can add these domain extensions in libs/Zend/Validate/Hostname.php: \n\n" . $out); } } |