verify : add the static methods
verify : add the unit tests git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3520 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
96
Tests/verifyTest.php
Normal file
96
Tests/verifyTest.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
require_once ("verify.php");
|
||||
|
||||
/** Test the Verify */
|
||||
class test_verify extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
///////////////
|
||||
// DATES //
|
||||
///////////////
|
||||
public function test_is_datetimeSQL1 ()
|
||||
{
|
||||
$verify = new \verify ();
|
||||
$res = $verify->is_datetimeSQL ("2017-04-13 22:55:17");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
|
||||
public function test_is_datetimeSQL2 ()
|
||||
{
|
||||
$verify = new \verify ();
|
||||
$res = $verify->is_datetimeSQL ("2017-13-55 22:55:17");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
|
||||
public function test_staticIs_datetimeSQL1 ()
|
||||
{
|
||||
$res = \verify::staticIs_datetimeSQL ("2017-04-13 22:55:17");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
|
||||
public function test_staticIs_datetimeSQL2 ()
|
||||
{
|
||||
$res = \verify::staticIs_datetimeSQL ("2017-13-55 22:55:17");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
|
||||
/////////////////
|
||||
// NUMBERS //
|
||||
/////////////////
|
||||
public function test_staticIs_integer1 ()
|
||||
{
|
||||
$res = \verify::staticIs_integer ("2017-04-13 22:55:17");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
|
||||
public function test_staticIs_integer2 ()
|
||||
{
|
||||
$res = \verify::staticIs_integer ("01234");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
|
||||
public function test_staticIs_integer3 ()
|
||||
{
|
||||
$res = \verify::staticIs_integer ("0x1234");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
|
||||
public function test_staticIs_integer4 ()
|
||||
{
|
||||
$res = \verify::staticIs_integer ("");
|
||||
$this->assertSame ($res, false);
|
||||
}
|
||||
|
||||
////////////////
|
||||
// EMAILS //
|
||||
////////////////
|
||||
|
||||
/////////////
|
||||
// URL //
|
||||
/////////////
|
||||
public function test_is_url1 ()
|
||||
{
|
||||
$verify = new \verify ();
|
||||
$res = $verify->is_url ("invalid");
|
||||
$this->assertsame ($res, false);
|
||||
}
|
||||
|
||||
public function test_is_url2 ()
|
||||
{
|
||||
$verify = new \verify ();
|
||||
$res = $verify->is_url ("http://valid");
|
||||
$this->assertsame ($res, true);
|
||||
}
|
||||
|
||||
public function test_staticIs_url1 ()
|
||||
{
|
||||
$res = \verify::staticIs_url ("invalid");
|
||||
$this->assertsame ($res, false);
|
||||
}
|
||||
|
||||
public function test_staticIs_url2 ()
|
||||
{
|
||||
$res = \verify::staticIs_url ("http://valid");
|
||||
$this->assertsame ($res, true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user