Improve API to return id instead of a boolean

This commit is contained in:
Frédéric Guillot
2014-11-22 18:22:10 -05:00
parent 15038cdb10
commit 77e10d2582
13 changed files with 270 additions and 310 deletions

View File

@@ -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));