summaryrefslogtreecommitdiff
path: root/tests/units/Model/UserTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units/Model/UserTest.php')
-rw-r--r--tests/units/Model/UserTest.php28
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/units/Model/UserTest.php b/tests/units/Model/UserTest.php
index 0987fa56..7501f2e0 100644
--- a/tests/units/Model/UserTest.php
+++ b/tests/units/Model/UserTest.php
@@ -5,7 +5,6 @@ require_once __DIR__.'/../Base.php';
use Kanboard\Model\User;
use Kanboard\Model\Subtask;
use Kanboard\Model\Comment;
-use Kanboard\Model\Task;
use Kanboard\Model\TaskCreation;
use Kanboard\Model\TaskFinder;
use Kanboard\Model\Project;
@@ -96,13 +95,14 @@ class UserTest extends Base
$this->assertEquals('you', $users[2]['username']);
}
- public function testGetList()
+ public function testGetActiveUsersList()
{
$u = new User($this->container);
$this->assertEquals(2, $u->create(array('username' => 'you')));
$this->assertEquals(3, $u->create(array('username' => 'me', 'name' => 'Me too')));
+ $this->assertEquals(4, $u->create(array('username' => 'foobar', 'is_active' => 0)));
- $users = $u->getList();
+ $users = $u->getActiveUsersList();
$expected = array(
1 => 'admin',
@@ -112,7 +112,7 @@ class UserTest extends Base
$this->assertEquals($expected, $users);
- $users = $u->getList(true);
+ $users = $u->getActiveUsersList(true);
$expected = array(
User::EVERYBODY_ID => 'Everybody',
@@ -391,4 +391,24 @@ class UserTest extends Base
$this->assertEquals('toto', $user['username']);
$this->assertEmpty($user['token']);
}
+
+ public function testEnableDisable()
+ {
+ $userModel = new User($this->container);
+ $this->assertEquals(2, $userModel->create(array('username' => 'toto')));
+
+ $this->assertTrue($userModel->isActive(2));
+ $user = $userModel->getById(2);
+ $this->assertEquals(1, $user['is_active']);
+
+ $this->assertTrue($userModel->disable(2));
+ $user = $userModel->getById(2);
+ $this->assertEquals(0, $user['is_active']);
+ $this->assertFalse($userModel->isActive(2));
+
+ $this->assertTrue($userModel->enable(2));
+ $user = $userModel->getById(2);
+ $this->assertEquals(1, $user['is_active']);
+ $this->assertTrue($userModel->isActive(2));
+ }
}