diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/units/Core/Security/TokenTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/units/Core/Security/TokenTest.php b/tests/units/Core/Security/TokenTest.php new file mode 100644 index 00000000..dbb7bd1a --- /dev/null +++ b/tests/units/Core/Security/TokenTest.php @@ -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)); + } +} |