Passage en Namespace et tous les tests fonctionnels OK
This commit is contained in:
@@ -7,12 +7,14 @@
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
/** Test the csrf.php file */
|
||||
class csrfTest extends \PHPUnit_Framework_TestCase
|
||||
use Domframework\Csrf;
|
||||
|
||||
/** Test the Csrf.php file */
|
||||
class CsrfTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_csrf1 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$res = $csrf->createToken ();
|
||||
$GLOBALS["CSRFTEST-Token"] = $res;
|
||||
$this->assertSame (30, strlen ($res));
|
||||
@@ -20,7 +22,7 @@ class csrfTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_csrf2 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$res = $csrf->createToken ();
|
||||
$this->assertSame (
|
||||
strspn ($res,
|
||||
@@ -29,14 +31,14 @@ class csrfTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_csrf3 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$this->setExpectedException ("Exception");
|
||||
$res = $csrf->checkToken ("NOT VALID TOKEN");
|
||||
}
|
||||
|
||||
public function test_csrf4 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$token = $csrf->createToken ();
|
||||
$res = $csrf->checkToken ($token);
|
||||
$this->assertSame (true, $res);
|
||||
@@ -44,7 +46,7 @@ class csrfTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_csrf5 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$token = $csrf->createToken ();
|
||||
$res = $csrf->extendToken ($token);
|
||||
$this->assertSame (true, $res);
|
||||
@@ -52,7 +54,7 @@ class csrfTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_csrf6 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$token = $csrf->createToken ();
|
||||
$res = $csrf->getToken ();
|
||||
$this->assertSame ($token, $res);
|
||||
@@ -60,16 +62,16 @@ class csrfTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_csrf7 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$res = $csrf->getToken ();
|
||||
$this->assertSame (30, strlen ($res));
|
||||
}
|
||||
|
||||
public function test_csrf_multiple_1 ()
|
||||
{
|
||||
$csrf1 = new csrf ();
|
||||
$csrf1 = new Csrf ();
|
||||
$token1 = $csrf1->createToken ();
|
||||
$csrf2 = new csrf ();
|
||||
$csrf2 = new Csrf ();
|
||||
$token2 = $csrf2->createToken ();
|
||||
$this->assertSame (true,
|
||||
$csrf2->checkToken ($token1) && $csrf2->checkToken ($token2));
|
||||
@@ -77,16 +79,16 @@ class csrfTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function test_csrf_multiple_extend_2 ()
|
||||
{
|
||||
$csrf = new csrf ();
|
||||
$csrf = new Csrf ();
|
||||
$res = $csrf->extendToken ($GLOBALS["CSRFTEST-Token"]);
|
||||
$this->assertSame (true, $res);
|
||||
}
|
||||
|
||||
public function test_csrf_multiple_get ()
|
||||
{
|
||||
$csrf1 = new csrf ();
|
||||
$csrf1 = new Csrf ();
|
||||
$token1 = $csrf1->createToken ();
|
||||
$csrf2 = new csrf ();
|
||||
$csrf2 = new Csrf ();
|
||||
$token2 = $csrf2->getToken ();
|
||||
$this->assertSame ($token1, $token2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user