summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-22 18:22:10 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-22 18:22:10 -0500
commit77e10d25829f3523a168bf61424fac99a539f8be (patch)
tree9b3d274146fa9543c4734a945e61b9d975960ff6 /tests/units
parent15038cdb10f8c691edc7980fd1aed32dcbed3f9f (diff)
Improve API to return id instead of a boolean
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/CommentTest.php10
-rw-r--r--tests/units/NotificationTest.php16
-rw-r--r--tests/units/ProjectPermissionTest.php4
-rw-r--r--tests/units/TaskPermissionTest.php4
-rw-r--r--tests/units/UserTest.php8
5 files changed, 21 insertions, 21 deletions
diff --git a/tests/units/CommentTest.php b/tests/units/CommentTest.php
index 8846c0b8..36ff1352 100644
--- a/tests/units/CommentTest.php
+++ b/tests/units/CommentTest.php
@@ -17,7 +17,7 @@ class CommentTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'test1')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
- $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'bla bla', 'user_id' => 1)));
+ $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'bla bla', 'user_id' => 1)));
$comment = $c->getById(1);
@@ -37,9 +37,9 @@ class CommentTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'test1')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
- $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c1', 'user_id' => 1)));
- $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c2', 'user_id' => 1)));
- $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c3', 'user_id' => 1)));
+ $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'c1', 'user_id' => 1)));
+ $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'c2', 'user_id' => 1)));
+ $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'c3', 'user_id' => 1)));
$comments = $c->getAll(1);
@@ -60,7 +60,7 @@ class CommentTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'test1')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 3, 'owner_id' => 1)));
- $this->assertTrue($c->create(array('task_id' => 1, 'comment' => 'c1', 'user_id' => 1)));
+ $this->assertNotFalse($c->create(array('task_id' => 1, 'comment' => 'c1', 'user_id' => 1)));
$this->assertTrue($c->update(array('id' => 1, 'comment' => 'bla')));
$comment = $c->getById(1);
diff --git a/tests/units/NotificationTest.php b/tests/units/NotificationTest.php
index 770a9829..d8e623e1 100644
--- a/tests/units/NotificationTest.php
+++ b/tests/units/NotificationTest.php
@@ -19,16 +19,16 @@ class NotificationTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
// Email + Notifications enabled
- $this->assertTrue($u->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1)));
+ $this->assertNotFalse($u->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1)));
// No email + Notifications enabled
- $this->assertTrue($u->create(array('username' => 'user2', 'email' => '', 'notifications_enabled' => 1)));
+ $this->assertNotFalse($u->create(array('username' => 'user2', 'email' => '', 'notifications_enabled' => 1)));
// Email + Notifications enabled
- $this->assertTrue($u->create(array('username' => 'user3', 'email' => 'user3@here', 'notifications_enabled' => 1)));
+ $this->assertNotFalse($u->create(array('username' => 'user3', 'email' => 'user3@here', 'notifications_enabled' => 1)));
// No email + notifications disabled
- $this->assertTrue($u->create(array('username' => 'user4')));
+ $this->assertNotFalse($u->create(array('username' => 'user4')));
// Nobody is member of any projects
$this->assertEmpty($pp->getMembers(1));
@@ -61,16 +61,16 @@ class NotificationTest extends Base
$this->assertEquals(3, $p->create(array('name' => 'UnitTest3', 'is_everybody_allowed' => 1)));
// Email + Notifications enabled
- $this->assertTrue($u->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1)));
+ $this->assertNotFalse($u->create(array('username' => 'user1', 'email' => 'user1@here', 'notifications_enabled' => 1)));
// No email + Notifications enabled
- $this->assertTrue($u->create(array('username' => 'user2', 'email' => '', 'notifications_enabled' => 1)));
+ $this->assertNotFalse($u->create(array('username' => 'user2', 'email' => '', 'notifications_enabled' => 1)));
// Email + Notifications enabled
- $this->assertTrue($u->create(array('username' => 'user3', 'email' => 'user3@here', 'notifications_enabled' => 1)));
+ $this->assertNotFalse($u->create(array('username' => 'user3', 'email' => 'user3@here', 'notifications_enabled' => 1)));
// No email + notifications disabled
- $this->assertTrue($u->create(array('username' => 'user4')));
+ $this->assertNotFalse($u->create(array('username' => 'user4')));
// We allow all users to be member of our projects
$this->assertTrue($pp->allowUser(1, 1));
diff --git a/tests/units/ProjectPermissionTest.php b/tests/units/ProjectPermissionTest.php
index 394e0ac5..b169b63e 100644
--- a/tests/units/ProjectPermissionTest.php
+++ b/tests/units/ProjectPermissionTest.php
@@ -11,8 +11,8 @@ class ProjectPermissionTest extends Base
public function testAllowEverybody()
{
$user = new User($this->container);
- $this->assertTrue($user->create(array('username' => 'unittest#1', 'password' => 'unittest')));
- $this->assertTrue($user->create(array('username' => 'unittest#2', 'password' => 'unittest')));
+ $this->assertNotFalse($user->create(array('username' => 'unittest#1', 'password' => 'unittest')));
+ $this->assertNotFalse($user->create(array('username' => 'unittest#2', 'password' => 'unittest')));
$p = new Project($this->container);
$pp = new ProjectPermission($this->container);
diff --git a/tests/units/TaskPermissionTest.php b/tests/units/TaskPermissionTest.php
index 963864b2..4b0b2b61 100644
--- a/tests/units/TaskPermissionTest.php
+++ b/tests/units/TaskPermissionTest.php
@@ -20,8 +20,8 @@ class TaskPermissionTest extends Base
$p = new Project($this->container);
$u = new User($this->container);
- $this->assertTrue($u->create(array('username' => 'toto', 'password' => '123456')));
- $this->assertTrue($u->create(array('username' => 'toto2', 'password' => '123456')));
+ $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456')));
+ $this->assertNotFalse($u->create(array('username' => 'toto2', 'password' => '123456')));
$this->assertEquals(1, $p->create(array('name' => 'Project #1')));
$this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'creator_id' => 1)));
$this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 1, 'creator_id' => 2)));
diff --git a/tests/units/UserTest.php b/tests/units/UserTest.php
index ebb76a92..6e535a35 100644
--- a/tests/units/UserTest.php
+++ b/tests/units/UserTest.php
@@ -73,8 +73,8 @@ class UserTest extends Base
public function testCreate()
{
$u = new User($this->container);
- $this->assertTrue($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
- $this->assertTrue($u->create(array('username' => 'titi', 'is_ldap_user' => 1)));
+ $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
+ $this->assertNotFalse($u->create(array('username' => 'titi', 'is_ldap_user' => 1)));
$this->assertFalse($u->create(array('username' => 'toto')));
$user = $u->getById(1);
@@ -105,7 +105,7 @@ class UserTest extends Base
public function testUpdate()
{
$u = new User($this->container);
- $this->assertTrue($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
+ $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
$this->assertTrue($u->update(array('id' => 2, 'username' => 'biloute')));
$user = $u->getById(2);
@@ -124,7 +124,7 @@ class UserTest extends Base
$tf = new TaskFinder($this->container);
$p = new Project($this->container);
- $this->assertTrue($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
+ $this->assertNotFalse($u->create(array('username' => 'toto', 'password' => '123456', 'name' => 'Toto')));
$this->assertEquals(1, $p->create(array('name' => 'Project #1')));
$this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'owner_id' => 2)));