Skip to content
Extraits de code Groupes Projets
Valider 7ca14d21 rédigé par mattab's avatar mattab
Parcourir les fichiers

Fix the integration test and patch Zend Validate

parent d83b2b2d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -492,6 +492,12 @@ class Zend_Validate_Hostname extends Zend_Validate_Abstract ...@@ -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),
'電訊盈科' => array(1 => self::VALID_UNICODE_DOMAIN),
'العليان' => array(1 => self::VALID_UNICODE_DOMAIN),
'嘉里' => array(1 => self::VALID_UNICODE_DOMAIN),
); );
......
...@@ -42,7 +42,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase ...@@ -42,7 +42,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
private function skipTestIfIdnNotAvailable() private function skipTestIfIdnNotAvailable()
{ {
if (!function_exists('idn_to_utf8')) { 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 ...@@ -64,13 +64,18 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
$email = 'test@example.' . $domainNameExtension; $email = 'test@example.' . $domainNameExtension;
if(!$this->isValid($email)) { 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... // 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) { if(count($errors) > 5)
$this->fail( implode(", ", $errors)); {
$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);
} }
} }
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter