-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d03bee
commit 9bf3a30
Showing
6 changed files
with
1,582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
require_once __DIR__ . '/../app/autoload.php'; | ||
use PHPUnit\Framework\TestCase; | ||
use Valimail\Valimail; | ||
|
||
|
||
class ValimailTest extends TestCase | ||
{ | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
function testValidEmail() | ||
{ | ||
/** Example Data */ | ||
$validEmail = array( | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]" | ||
); | ||
|
||
$countGoodEmail=0; | ||
foreach ($validEmail as $email) { | ||
$validate = new Valimail($email); | ||
if($validate->validateMXRecord()){ | ||
$countGoodEmail++; | ||
} | ||
|
||
} | ||
$this->assertEquals($countGoodEmail,count($validEmail)); | ||
} | ||
|
||
function testInvalidEmail() | ||
{ | ||
/** Example Data */ | ||
$invalidEmail = array( | ||
"xxx@com", | ||
"[email protected]", | ||
"[email protected]", | ||
"[email protected]" | ||
); | ||
|
||
$countBedEmail=0; | ||
foreach ($invalidEmail as $email) { | ||
$validate = new Valimail($email); | ||
if(!$validate->validateMXRecord()){ | ||
$countBedEmail++; | ||
} | ||
|
||
} | ||
$this->assertEquals($countBedEmail,count($invalidEmail)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
require_once __DIR__."/../vendor/autoload.php"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "nattaponra/valimail", | ||
"description": "The library to validate email before sending", | ||
"minimum-stability": "stable", | ||
"license": "proprietary", | ||
"authors": [ | ||
{ | ||
"name": "Nattapon Rakthong", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Valimail\\":"src" | ||
} | ||
|
||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^6.2" | ||
} | ||
} |
Oops, something went wrong.