summaryrefslogtreecommitdiff
path: root/tests/units/Auth
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-02-13 15:38:35 -0500
committerFrederic Guillot <fred@kanboard.net>2016-02-13 15:38:35 -0500
commit6161eaef9e107ddbfc104753eb5d48434de3b824 (patch)
tree6a689458e0705c8da272712b71358ccd992f8a8b /tests/units/Auth
parent567d623446d7e98393fb542c88d6d3b18b05cf6f (diff)
Enable/Disable users
Diffstat (limited to 'tests/units/Auth')
-rw-r--r--tests/units/Auth/DatabaseAuthTest.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/units/Auth/DatabaseAuthTest.php b/tests/units/Auth/DatabaseAuthTest.php
index a13b7fee..ac099a7e 100644
--- a/tests/units/Auth/DatabaseAuthTest.php
+++ b/tests/units/Auth/DatabaseAuthTest.php
@@ -3,6 +3,7 @@
require_once __DIR__.'/../Base.php';
use Kanboard\Auth\DatabaseAuth;
+use Kanboard\Model\User;
class DatabaseAuthTest extends Base
{
@@ -40,12 +41,21 @@ class DatabaseAuthTest extends Base
public function testIsvalidSession()
{
+ $userModel = new User($this->container);
$provider = new DatabaseAuth($this->container);
+
$this->assertFalse($provider->isValidSession());
- $this->container['sessionStorage']->user = array('id' => 1);
+ $this->assertEquals(2, $userModel->create(array('username' => 'foobar')));
+
+ $this->container['sessionStorage']->user = array('id' => 2);
$this->assertTrue($provider->isValidSession());
+ $this->container['sessionStorage']->user = array('id' => 3);
+ $this->assertFalse($provider->isValidSession());
+
+ $this->assertTrue($userModel->disable(2));
+
$this->container['sessionStorage']->user = array('id' => 2);
$this->assertFalse($provider->isValidSession());
}