summaryrefslogtreecommitdiff
path: root/tests/units/ProjectPermissionTest.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-10-05 12:32:44 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-10-05 12:32:44 -0400
commit7f5a871f84639a90eebd0ac1d0ee7f759e220cf6 (patch)
treef814b2fa2ae888d0b2e800f14c6c8d6b75e85428 /tests/units/ProjectPermissionTest.php
parentbae57838c2dd789064b246308c7cb3a33bba5b8e (diff)
Projects are not anymore visible to everybody by default
Diffstat (limited to 'tests/units/ProjectPermissionTest.php')
-rw-r--r--tests/units/ProjectPermissionTest.php29
1 files changed, 14 insertions, 15 deletions
diff --git a/tests/units/ProjectPermissionTest.php b/tests/units/ProjectPermissionTest.php
index 309fa63b..b8bd375a 100644
--- a/tests/units/ProjectPermissionTest.php
+++ b/tests/units/ProjectPermissionTest.php
@@ -8,7 +8,7 @@ use Model\User;
class ProjectPermissionTest extends Base
{
- public function testAllowEverybody()
+ public function testDisallowEverybody()
{
// We create a regular user
$user = new User($this->registry);
@@ -20,8 +20,8 @@ class ProjectPermissionTest extends Base
$this->assertEquals(1, $p->create(array('name' => 'UnitTest')));
$this->assertEmpty($pp->getAllowedUsers(1)); // Nobody is specified for the given project
- $this->assertTrue($pp->isUserAllowed(1, 1)); // Everybody should be allowed
- $this->assertTrue($pp->isUserAllowed(1, 2)); // Everybody should be allowed
+ $this->assertTrue($pp->isUserAllowed(1, 1)); // Admin should be allowed
+ $this->assertFalse($pp->isUserAllowed(1, 2)); // Regular user should be denied
}
public function testAllowUser()
@@ -37,6 +37,7 @@ class ProjectPermissionTest extends Base
// We allow the admin user
$this->assertTrue($pp->allowUser(1, 1));
+ $this->assertTrue($pp->allowUser(1, 2));
// Non-existant project
$this->assertFalse($pp->allowUser(50, 1));
@@ -44,12 +45,10 @@ class ProjectPermissionTest extends Base
// Non-existant user
$this->assertFalse($pp->allowUser(1, 50));
- // Our admin user should be allowed
- $this->assertEquals(array('1' => 'admin'), $pp->getAllowedUsers(1));
+ // Both users should be allowed
+ $this->assertEquals(array('1' => 'admin', '2' => 'unittest'), $pp->getAllowedUsers(1));
$this->assertTrue($pp->isUserAllowed(1, 1));
-
- // Our regular user should be forbidden
- $this->assertFalse($pp->isUserAllowed(1, 2));
+ $this->assertTrue($pp->isUserAllowed(1, 2));
}
public function testRevokeUser()
@@ -69,9 +68,9 @@ class ProjectPermissionTest extends Base
// We should have nobody in the users list
$this->assertEmpty($pp->getAllowedUsers(1));
- // Our admin user and our regular user should be allowed
+ // Only admin is allowed
$this->assertTrue($pp->isUserAllowed(1, 1));
- $this->assertTrue($pp->isUserAllowed(1, 2));
+ $this->assertFalse($pp->isUserAllowed(1, 2));
// We allow only the regular user
$this->assertTrue($pp->allowUser(1, 2));
@@ -103,9 +102,9 @@ class ProjectPermissionTest extends Base
$this->assertTrue($pp->revokeUser(1, 1));
$this->assertEmpty($pp->getAllowedUsers(1));
- // Everybody should be allowed again
+ // Only admin should be allowed again
$this->assertTrue($pp->isUserAllowed(1, 1));
- $this->assertTrue($pp->isUserAllowed(1, 2));
+ $this->assertFalse($pp->isUserAllowed(1, 2));
}
public function testUsersList()
@@ -119,9 +118,9 @@ class ProjectPermissionTest extends Base
// We create project
$this->assertEquals(1, $p->create(array('name' => 'UnitTest')));
- // No restriction, we should have everybody
+ // No restriction, we should have no body
$this->assertEquals(
- array('Unassigned', 'admin', 'unittest'),
+ array('Unassigned'),
$pp->getUsersList(1)
);
@@ -153,7 +152,7 @@ class ProjectPermissionTest extends Base
$this->assertTrue($pp->revokeUser(1, 1));
$this->assertEquals(
- array(0 => 'Unassigned', 1 => 'admin', 2 => 'unittest'),
+ array(0 => 'Unassigned'),
$pp->getUsersList(1)
);
}