mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-09-06 15:52:50 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 758a77525b | |||
| 5642614492 |
+10
-2
@@ -2,12 +2,17 @@ sudo: false
|
|||||||
|
|
||||||
language: php
|
language: php
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- $HOME/.composer/cache/files
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 5.3
|
|
||||||
- 5.4
|
- 5.4
|
||||||
- 5.5
|
- 5.5
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
|
- 7.1
|
||||||
|
- 7.2
|
||||||
- hhvm
|
- hhvm
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -18,6 +23,9 @@ matrix:
|
|||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- php: 5.3
|
- php: 5.3
|
||||||
|
dist: precise
|
||||||
|
- php: 5.3
|
||||||
|
dist: precise
|
||||||
env: deps=low
|
env: deps=low
|
||||||
- php: 5.4
|
- php: 5.4
|
||||||
env: deps=no
|
env: deps=no
|
||||||
@@ -31,5 +39,5 @@ install:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- mkdir -p build/logs
|
- mkdir -p build/logs
|
||||||
- phpunit --coverage-clover build/logs/clover.xml
|
- composer test -- --coverage-clover build/logs/clover.xml
|
||||||
|
|
||||||
|
|||||||
@@ -24,5 +24,8 @@
|
|||||||
"psr-0": {
|
"psr-0": {
|
||||||
"Egulias\\": "src/"
|
"Egulias\\": "src/"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"test": "phpunit"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class EmailValidator implements EmailValidatorInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ($strict ? (!$this->hasWarnings() && !$dnsProblemExists) : true);
|
return !($dnsProblemExists || $strict && $this->hasWarnings());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -184,7 +184,10 @@ class EmailValidator implements EmailValidatorInterface
|
|||||||
*/
|
*/
|
||||||
protected function checkDNS()
|
protected function checkDNS()
|
||||||
{
|
{
|
||||||
$mxRecordExists = checkdnsrr(trim($this->parser->getParsedDomainPart()), 'MX');
|
$host = $this->parser->getParsedDomainPart();
|
||||||
|
$host = rtrim($host, '.') . '.';
|
||||||
|
|
||||||
|
$mxRecordExists = checkdnsrr($host, 'MX');
|
||||||
|
|
||||||
if (!$mxRecordExists) {
|
if (!$mxRecordExists) {
|
||||||
$this->warnings[] = self::DNSWARN_NO_RECORD;
|
$this->warnings[] = self::DNSWARN_NO_RECORD;
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testValidEmailsWithWarningsCheck($warnings, $email)
|
public function testValidEmailsWithWarningsCheck($warnings, $email)
|
||||||
{
|
{
|
||||||
$this->assertTrue($this->validator->isValid($email, true));
|
$this->assertFalse($this->validator->isValid($email, true));
|
||||||
|
|
||||||
$this->assertEquals($warnings, $this->validator->getWarnings());
|
$this->assertEquals($warnings, $this->validator->getWarnings());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user