Passage en Namespace et tous les tests fonctionnels OK
This commit is contained in:
@@ -7,22 +7,24 @@
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
/** Test the spfcheck tools
|
||||
use Domframework\Spfcheck;
|
||||
|
||||
/** Test the Spfcheck tools
|
||||
*/
|
||||
class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
class SpfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_getRecords_NoSPF ()
|
||||
{
|
||||
$this->expectException ("Exception",
|
||||
"Can not find a valid SPF TXT entry in DNS for domain ".
|
||||
"'notfound.tester.fournier38.fr'", 403);
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("notfound.tester.fournier38.fr");
|
||||
}
|
||||
|
||||
public function test_getRecords_SPFReject ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("reject.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("reject.spf.tester.fournier38.fr" =>
|
||||
@@ -33,14 +35,14 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->expectException ("Exception",
|
||||
"SPFCheck : Too much DNS requests (30 >= 30)", 500);
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("loop.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res, array ());
|
||||
}
|
||||
|
||||
public function test_getRecords_Include_emptyInclude ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("includeempty.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("includeempty.spf.tester.fournier38.fr" =>
|
||||
@@ -49,7 +51,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_Redirect_emptyRedirect ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("redirectempty.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("redirectempty.spf.tester.fournier38.fr" =>
|
||||
@@ -58,7 +60,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_MX_emptyMX ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("mx.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("mx.spf.tester.fournier38.fr" =>
|
||||
@@ -67,13 +69,13 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_MX_validMX ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("mxvalid.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("mxvalid.spf.tester.fournier38.fr" => array (
|
||||
"mx:tester.fournier38.fr" => array (
|
||||
"2a01:e0a:234:3931::103",
|
||||
"2a01:e0a:289:3090::206",
|
||||
"2a01:e0a:163:38f1::103",
|
||||
"2a01:e0a:2a7:9cd0::206",
|
||||
"82.64.55.197",
|
||||
"82.64.75.195"),
|
||||
"-all" => array ())));
|
||||
@@ -81,7 +83,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_A_emptyA ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("a.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("a.spf.tester.fournier38.fr" =>
|
||||
@@ -90,19 +92,19 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_A_validA ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("avalid.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("avalid.spf.tester.fournier38.fr" => array (
|
||||
"a:tester.fournier38.fr" => array (
|
||||
"2a01:e0a:234:3931::100",
|
||||
"2a01:e0a:163:38f1::100",
|
||||
"82.64.55.197",),
|
||||
"-all" => array ())));
|
||||
}
|
||||
|
||||
public function test_getRecords_IP4_emptyIP4 ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("ip4empty.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("ip4empty.spf.tester.fournier38.fr" => array (
|
||||
@@ -112,7 +114,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_IP4_invalidIP4 ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("ip4invalid.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("ip4invalid.spf.tester.fournier38.fr" => array (
|
||||
@@ -122,7 +124,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_IP4_validIP4 ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("ip4valid.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("ip4valid.spf.tester.fournier38.fr" => array (
|
||||
@@ -132,7 +134,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_IP6_emptyIP6 ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("ip6empty.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("ip6empty.spf.tester.fournier38.fr" => array (
|
||||
@@ -142,7 +144,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_IP6_invalidIP6 ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("ip6invalid.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("ip6invalid.spf.tester.fournier38.fr" => array (
|
||||
@@ -152,7 +154,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_IP6_validIP6 ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("ip6valid.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("ip6valid.spf.tester.fournier38.fr" => array (
|
||||
@@ -162,7 +164,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_PTR ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("ptrvalid.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("ptrvalid.spf.tester.fournier38.fr" => array (
|
||||
@@ -172,7 +174,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_All_Multiple ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("allmultiple.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("allmultiple.spf.tester.fournier38.fr" => array (
|
||||
@@ -182,7 +184,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_All_NotEnd ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("allnotend.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("allnotend.spf.tester.fournier38.fr" => array (
|
||||
@@ -192,7 +194,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_All_NotSet ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("allnotset.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("allnotset.spf.tester.fournier38.fr" => array (
|
||||
@@ -201,7 +203,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_wideIPRange ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$spfcheck->getRecords ("wide.spf.tester.fournier38.fr");
|
||||
$res = $spfcheck->getErrors ();
|
||||
$this->assertSame ($res,
|
||||
@@ -213,7 +215,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_recordsWithPlus ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("plus.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("plus.spf.tester.fournier38.fr" => array (
|
||||
@@ -228,7 +230,7 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_getRecords_Unknown ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->getRecords ("unknown.spf.tester.fournier38.fr");
|
||||
$this->assertSame ($res,
|
||||
array ("unknown.spf.tester.fournier38.fr" => array (
|
||||
@@ -238,28 +240,28 @@ class spfcheckTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_ipCheckToSPF_OK_inA ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->ipCheckToSPF ("plus.spf.tester.fournier38.fr", "178.33.236.5");
|
||||
$this->assertSame ($res, "PASS");
|
||||
}
|
||||
|
||||
public function test_ipCheckToSPF_FAIL_inALL ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->ipCheckToSPF ("plus.spf.tester.fournier38.fr", "1.3.6.5");
|
||||
$this->assertSame ($res, "FAIL");
|
||||
}
|
||||
|
||||
public function test_ipCheckToSPF_OK_inALL ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->ipCheckToSPF ("plus.spf.tester.fournier38.fr", "1.3.6.5");
|
||||
$this->assertSame ($res, "FAIL");
|
||||
}
|
||||
|
||||
public function test_ipCheckToSPF_FAIL_inIP4 ()
|
||||
{
|
||||
$spfcheck = new spfcheck ();
|
||||
$spfcheck = new Spfcheck ();
|
||||
$res = $spfcheck->ipCheckToSPF ("plus.spf.tester.fournier38.fr", "137.74.69.64");
|
||||
$this->assertSame ($res, "FAIL");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user