Move token generation to Security namespace

This commit is contained in:
Frederic Guillot
2015-10-25 15:05:19 -04:00
parent 06e9486c59
commit 6756ef2301
15 changed files with 80 additions and 86 deletions

View File

@@ -0,0 +1,29 @@
<?php
require_once __DIR__.'/../../Base.php';
use Kanboard\Core\Security\Token;
class TokenTest extends Base
{
public function testGenerateToken()
{
$t1 = Token::getToken();
$t2 = Token::getToken();
$this->assertNotEmpty($t1);
$this->assertNotEmpty($t2);
$this->assertNotEquals($t1, $t2);
}
public function testCSRFTokens()
{
$token = new Token($this->container);
$t1 = $token->getCSRFToken();
$this->assertNotEmpty($t1);
$this->assertTrue($token->validateCSRFToken($t1));
$this->assertFalse($token->validateCSRFToken($t1));
}
}