diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-10-21 18:51:59 -0400 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-10-21 18:51:59 -0400 |
commit | 2c056bb9bbfd22c7c2225964d994c79a60b7f64d (patch) | |
tree | f68c0f3f503ba4fd199eed2aee2cb201a1cc3a62 /tests/units | |
parent | 88a1120d9b4fde8b3e8cddad6d2be3cdd9fbf806 (diff) |
Add option to allow everybody on a project
Diffstat (limited to 'tests/units')
-rw-r--r-- | tests/units/ProjectPermissionTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/units/ProjectPermissionTest.php b/tests/units/ProjectPermissionTest.php index b8bd375a..ee608d03 100644 --- a/tests/units/ProjectPermissionTest.php +++ b/tests/units/ProjectPermissionTest.php @@ -8,6 +8,32 @@ use Model\User; class ProjectPermissionTest extends Base { + public function testAllowEverybody() + { + $user = new User($this->registry); + $this->assertTrue($user->create(array('username' => 'unittest#1', 'password' => 'unittest'))); + $this->assertTrue($user->create(array('username' => 'unittest#2', 'password' => 'unittest'))); + + $p = new Project($this->registry); + $pp = new ProjectPermission($this->registry); + + $this->assertEquals(1, $p->create(array('name' => 'UnitTest'))); + $this->assertFalse($pp->isEverybodyAllowed(1)); + $this->assertTrue($pp->isUserAllowed(1, 1)); + $this->assertFalse($pp->isUserAllowed(1, 2)); + $this->assertFalse($pp->isUserAllowed(1, 3)); + $this->assertEquals(array(), $pp->getAllowedUsers(1)); + $this->assertEquals(array('Unassigned'), $pp->getUsersList(1)); + + $this->assertTrue($p->update(array('id' => 1, 'is_everybody_allowed' => 1))); + $this->assertTrue($pp->isEverybodyAllowed(1)); + $this->assertTrue($pp->isUserAllowed(1, 1)); + $this->assertTrue($pp->isUserAllowed(1, 2)); + $this->assertTrue($pp->isUserAllowed(1, 3)); + $this->assertEquals(array('1' => 'admin', '2' => 'unittest#1', '3' => 'unittest#2'), $pp->getAllowedUsers(1)); + $this->assertEquals(array('Unassigned', '1' => 'admin', '2' => 'unittest#1', '3' => 'unittest#2'), $pp->getUsersList(1)); + } + public function testDisallowEverybody() { // We create a regular user |