From 4505d2060a04e40225bc0efbc5228b5106eedb3d Mon Sep 17 00:00:00 2001 From: Eduardo Gulias Davis Date: Sun, 15 May 2016 11:46:59 +0200 Subject: [PATCH] New home for all the tests. Fixed namespaces (#105) * New home for all the tests. Fixed namespaces * small code improvement * Skipping tests failing only in Travis --- .../Validation/SpoofCheckValidation.php | 3 +- .../EmailValidator/EmailLexerTest.php | 2 +- .../EmailValidator/EmailValidatorTest.php | 0 .../Validation/DNSCheckValidationTest.php | 0 .../MultipleValidationWitAndTest.php | 0 .../NoWarningsRFCValidationTest.php | 0 .../Validation/RFCValidationTest.php | 0 .../Validation/SpoofCheckValidationTest.php | 1 + .../Performance/AgainstFilterVar.php | 4 +- .../Performance/AgainstOldIsemail.php | 5 +- composer.json | 13 +++- composer.lock | 77 ++++++++++++++----- phpunit.xml.dist | 2 +- tests/bootstrap.php | 8 -- 14 files changed, 76 insertions(+), 39 deletions(-) rename {tests => Tests}/EmailValidator/EmailLexerTest.php (99%) rename {tests => Tests}/EmailValidator/EmailValidatorTest.php (100%) rename {tests => Tests}/EmailValidator/Validation/DNSCheckValidationTest.php (100%) rename {tests => Tests}/EmailValidator/Validation/MultipleValidationWitAndTest.php (100%) rename {tests => Tests}/EmailValidator/Validation/NoWarningsRFCValidationTest.php (100%) rename {tests => Tests}/EmailValidator/Validation/RFCValidationTest.php (100%) rename {tests => Tests}/Performance/AgainstFilterVar.php (91%) rename {tests => Tests}/Performance/AgainstOldIsemail.php (87%) delete mode 100644 tests/bootstrap.php diff --git a/EmailValidator/Validation/SpoofCheckValidation.php b/EmailValidator/Validation/SpoofCheckValidation.php index 5bba4b8..268e35e 100644 --- a/EmailValidator/Validation/SpoofCheckValidation.php +++ b/EmailValidator/Validation/SpoofCheckValidation.php @@ -20,10 +20,9 @@ class SpoofCheckValidation implements EmailValidation if ($checker->isSuspicious($email)) { $this->error = new SpoofEmail(); - return false; } - return true; + return $this->error === null; } public function getError() diff --git a/tests/EmailValidator/EmailLexerTest.php b/Tests/EmailValidator/EmailLexerTest.php similarity index 99% rename from tests/EmailValidator/EmailLexerTest.php rename to Tests/EmailValidator/EmailLexerTest.php index d5389ef..cab2152 100644 --- a/tests/EmailValidator/EmailLexerTest.php +++ b/Tests/EmailValidator/EmailLexerTest.php @@ -1,6 +1,6 @@ markTestSkipped("Skipped for Travis CI since it is failing on this test for unknown reasons."); $validation = new SpoofCheckValidation(); $this->assertTrue($validation->isValid($email, new EmailLexer())); diff --git a/tests/Performance/AgainstFilterVar.php b/Tests/Performance/AgainstFilterVar.php similarity index 91% rename from tests/Performance/AgainstFilterVar.php rename to Tests/Performance/AgainstFilterVar.php index 9dea687..34a2530 100644 --- a/tests/Performance/AgainstFilterVar.php +++ b/Tests/Performance/AgainstFilterVar.php @@ -2,11 +2,11 @@ use Egulias\EmailValidator\EmailValidator; -require __DIR__ . '/../bootstrap.php'; +require __DIR__ . '/../../vendor/autoload.php'; $iterations = 10000; -$testingMail = 'fabien@symfony.com'; +$testingMail = 'example@example.com'; echo 'Testing ' . $iterations . ' iterations with ' . $testingMail . PHP_EOL; $a = microtime(true); diff --git a/tests/Performance/AgainstOldIsemail.php b/Tests/Performance/AgainstOldIsemail.php similarity index 87% rename from tests/Performance/AgainstOldIsemail.php rename to Tests/Performance/AgainstOldIsemail.php index d0ba393..b1ec9df 100644 --- a/tests/Performance/AgainstOldIsemail.php +++ b/Tests/Performance/AgainstOldIsemail.php @@ -2,12 +2,11 @@ use Egulias\EmailValidator\EmailValidator; -require __DIR__ . '/../bootstrap.php'; -require __DIR__ . '/../../../isemail/is_email.php'; +require __DIR__ . '/../../vendor/autoload.php'; $iterations = 10000; -$testingMail = 'fabien@symfony.com'; +$testingMail = 'example@example.com'; echo 'Testing ' . $iterations . ' iterations with ' . $testingMail . PHP_EOL; $a = microtime(true); diff --git a/composer.json b/composer.json index f5a40e2..b854a11 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "egulias/email-validator", - "description": "A library for validating emails", + "description": "A library for validating emails against several RFCs", "homepage": "https://github.com/egulias/EmailValidator", "type": "Library", "keywords": ["email", "validation", "validator", "emailvalidation", "emailvalidator"], @@ -13,13 +13,20 @@ "dev-master": "2.0.x-dev" } }, + "repositories": [ + { + "type": "git", + "url": "https://github.com/dominicsayers/isemail" + } + ], "require": { "php": ">= 5.5", - "doctrine/lexer": "~1.0,>=1.0.1" + "doctrine/lexer": "^1.0.1" }, "require-dev" : { "satooshi/php-coveralls": "dev-master", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^4.8.0", + "dominicsayers/isemail": "dev-master" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 45635c4..ec827df 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "2c5932404194e3b36ba0393169c080e9", - "content-hash": "f690de9ccec7c67ab8552dfc2ddfa49d", + "hash": "cd8cdb976fb5cd5012d94c224aa4fd4b", + "content-hash": "b0395bec21f73086fad52837dc689634", "packages": [ { "name": "doctrine/lexer", @@ -117,6 +117,41 @@ ], "time": "2015-06-14 21:17:01" }, + { + "name": "dominicsayers/isemail", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/dominicsayers/isemail", + "reference": "64286085b40c39e6f39b1d23276d90635e5b3099" + }, + "type": "library", + "autoload": { + "files": [ + "is_email.php" + ] + }, + "license": [ + "BSD" + ], + "authors": [ + { + "name": "Dominic Sayers", + "email": "dominic@sayers.cc" + } + ], + "description": "Checks an email address against the following RFCs: 3696, 1123, 4291, 5321, 5322", + "homepage": "http://isemail.info", + "keywords": [ + "email", + "validation" + ], + "support": { + "source": "https://github.com/dominicsayers/isemail", + "issues": "https://github.com/dominicsayers/isemail/issues" + }, + "time": "2014-11-26 12:46:56" + }, { "name": "guzzlehttp/guzzle", "version": "6.2.0", @@ -551,21 +586,24 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.7", + "version": "1.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", + "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "require-dev": { + "phpunit/phpunit": "~4|~5" + }, "type": "library", "autoload": { "classmap": [ @@ -588,7 +626,7 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2016-05-12 18:03:57" }, { "name": "phpunit/php-token-stream", @@ -641,16 +679,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.8.24", + "version": "4.8.25", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a1066c562c52900a142a0e2bbf0582994671385e" + "reference": "6d1588a6542a52ed89636e5a9876bc7502bbb853" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1066c562c52900a142a0e2bbf0582994671385e", - "reference": "a1066c562c52900a142a0e2bbf0582994671385e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6d1588a6542a52ed89636e5a9876bc7502bbb853", + "reference": "6d1588a6542a52ed89636e5a9876bc7502bbb853", "shasum": "" }, "require": { @@ -664,7 +702,7 @@ "phpunit/php-code-coverage": "~2.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", + "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", @@ -709,7 +747,7 @@ "testing", "xunit" ], - "time": "2016-03-14 06:16:08" + "time": "2016-05-10 18:47:12" }, { "name": "phpunit/phpunit-mock-objects", @@ -1290,7 +1328,7 @@ }, { "name": "symfony/config", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -1343,7 +1381,7 @@ }, { "name": "symfony/console", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -1403,7 +1441,7 @@ }, { "name": "symfony/filesystem", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -1511,7 +1549,7 @@ }, { "name": "symfony/stopwatch", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -1560,7 +1598,7 @@ }, { "name": "symfony/yaml", - "version": "v3.0.5", + "version": "v3.0.6", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -1611,7 +1649,8 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "satooshi/php-coveralls": 20 + "satooshi/php-coveralls": 20, + "dominicsayers/isemail": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7652c75..b0812f9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -13,7 +13,7 @@ > - ./tests/ + ./Tests/EmailValidator ./vendor/ diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index 676c4b1..0000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,8 +0,0 @@ -