Inital commit for unit test configuration

This commit is contained in:
Manish Verma
2018-09-05 12:36:46 +05:30
committed by Manish Verma
parent 2f0796e954
commit e0436b7757
252 changed files with 3219 additions and 1631 deletions

View File

@@ -18,6 +18,13 @@ class DNSCheckValidation implements EmailValidation
* @var InvalidEmail
*/
private $error;
public function __construct()
{
if (!extension_loaded('intl')) {
throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
}
}
public function isValid($email, EmailLexer $emailLexer)
{
@@ -44,7 +51,11 @@ class DNSCheckValidation implements EmailValidation
protected function checkDNS($host)
{
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46), '.') . '.';
$variant = INTL_IDNA_VARIANT_2003;
if ( defined('INTL_IDNA_VARIANT_UTS46') ) {
$variant = INTL_IDNA_VARIANT_UTS46;
}
$host = rtrim(idn_to_ascii($host, IDNA_DEFAULT, $variant), '.') . '.';
$Aresult = true;
$MXresult = checkdnsrr($host, 'MX');

View File

@@ -16,7 +16,7 @@ class SpoofCheckValidation implements EmailValidation
public function __construct()
{
if (!class_exists(Spoofchecker::class)) {
if (!extension_loaded('intl')) {
throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
}
}

View File

@@ -6,7 +6,7 @@ With the help of [PHPStorm](https://www.jetbrains.com/phpstorm/)
## Requirements ##
* [Composer](https://getcomposer.org) is required for installation
* [Spoofchecking](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) validation requires that your PHP system have the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl)
* [Spoofchecking](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/SpoofCheckValidation.php) and [DNSCheckValidation](https://github.com/egulias/EmailValidator/blob/master/EmailValidator/Validation/DNSCheckValidation.php) validation requires that your PHP system have the [PHP Internationalization Libraries](https://php.net/manual/en/book.intl.php) (also known as PHP Intl)
## Installation ##