summaryrefslogtreecommitdiff
path: root/tests/integration/UserProcedureTest.php
diff options
context:
space:
mode:
authori00171 <anton.delitsch@implema.se>2016-06-26 18:35:25 +0200
committeri00171 <anton.delitsch@implema.se>2016-06-26 18:35:25 +0200
commit47039d32c84ba699867920d2c3cb47a34b199b9d (patch)
tree4fbc2ec34889baeab00085e0509055dca7daee6a /tests/integration/UserProcedureTest.php
parent911be6ed00c1ece5d9ef2c16e80899bb7bffad67 (diff)
parentc110dffefe259c13e60193fb81ebb9d4b79504de (diff)
Merge branch 'master' of https://github.com/fguillot/kanboard
Diffstat (limited to 'tests/integration/UserProcedureTest.php')
-rw-r--r--tests/integration/UserProcedureTest.php63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/integration/UserProcedureTest.php b/tests/integration/UserProcedureTest.php
new file mode 100644
index 00000000..290f87fb
--- /dev/null
+++ b/tests/integration/UserProcedureTest.php
@@ -0,0 +1,63 @@
+<?php
+
+require_once __DIR__.'/BaseProcedureTest.php';
+
+class UserProcedureTest extends BaseProcedureTest
+{
+ public function testAll()
+ {
+ $this->assertCreateUser();
+ $this->assertGetUserById();
+ $this->assertGetUserByName();
+ $this->assertGetAllUsers();
+ $this->assertEnableDisableUser();
+ $this->assertUpdateUser();
+ $this->assertRemoveUser();
+ }
+
+ public function assertGetUserById()
+ {
+ $user = $this->app->getUser($this->userId);
+ $this->assertNotNull($user);
+ $this->assertEquals($this->username, $user['username']);
+ }
+
+ public function assertGetUserByName()
+ {
+ $user = $this->app->getUserByName($this->username);
+ $this->assertNotNull($user);
+ $this->assertEquals($this->username, $user['username']);
+ }
+
+ public function assertGetAllUsers()
+ {
+ $users = $this->app->getAllUsers();
+ $this->assertInternalType('array', $users);
+ $this->assertNotEmpty($users);
+ }
+
+ public function assertEnableDisableUser()
+ {
+ $this->assertTrue($this->app->disableUser($this->userId));
+ $this->assertFalse($this->app->isActiveUser($this->userId));
+ $this->assertTrue($this->app->enableUser($this->userId));
+ $this->assertTrue($this->app->isActiveUser($this->userId));
+ }
+
+ public function assertUpdateUser()
+ {
+ $this->assertTrue($this->app->updateUser(array(
+ 'id' => $this->userId,
+ 'name' => 'My user',
+ )));
+
+ $user = $this->app->getUser($this->userId);
+ $this->assertNotNull($user);
+ $this->assertEquals('My user', $user['name']);
+ }
+
+ public function assertRemoveUser()
+ {
+ $this->assertTrue($this->app->removeUser($this->userId));
+ }
+}