summaryrefslogtreecommitdiff
path: root/tests/units/Core
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-25 15:05:19 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-25 15:05:19 -0400
commit6756ef2301a5f624941b947ec9effd34b467de9a (patch)
treec93fe266cdef7ceef2234bf1cde61b5c4b738084 /tests/units/Core
parent06e9486c59831cdd1630647ea7474a39879a37da (diff)
Move token generation to Security namespace
Diffstat (limited to 'tests/units/Core')
-rw-r--r--tests/units/Core/Security/TokenTest.php29
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));
+ }
+}