Skip to content

Commit

Permalink
Master
Browse files Browse the repository at this point in the history
  • Loading branch information
nattaponra authored and Nattapon Rakthong committed Aug 23, 2017
1 parent 5d03bee commit 9bf3a30
Show file tree
Hide file tree
Showing 6 changed files with 1,582 additions and 0 deletions.
57 changes: 57 additions & 0 deletions Test/ValimailTest.php
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));
}

}
3 changes: 3 additions & 0 deletions app/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php

require_once __DIR__."/../vendor/autoload.php";
21 changes: 21 additions & 0 deletions composer.json
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"
}
}
Loading

0 comments on commit 9bf3a30

Please sign in to comment.