summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/Core/Http/RouterTest.php (renamed from tests/units/Core/RouterTest.php)4
-rw-r--r--tests/units/Core/Security/TokenTest.php29
2 files changed, 31 insertions, 2 deletions
diff --git a/tests/units/Core/RouterTest.php b/tests/units/Core/Http/RouterTest.php
index 753e1204..c2380247 100644
--- a/tests/units/Core/RouterTest.php
+++ b/tests/units/Core/Http/RouterTest.php
@@ -1,8 +1,8 @@
<?php
-require_once __DIR__.'/../Base.php';
+require_once __DIR__.'/../../Base.php';
-use Kanboard\Core\Router;
+use Kanboard\Core\Http\Router;
class RouterTest extends Base
{
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));
+ }
+}