Improve API to return id instead of a boolean
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user