diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-07-28 16:56:37 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-07-28 16:56:37 -0400 |
commit | f3e16da4ac8eb5f06c7f8a0aed49fd3dd11817ec (patch) | |
tree | 1c4ea8b49d63077a49a99c79fd7a96fcaeefadc4 /tests | |
parent | 837173cf935a7f5f9c12c69f131a63e0f181d8f3 (diff) |
Allow users to see inactive projects
Diffstat (limited to 'tests')
-rw-r--r-- | tests/units/Model/ProjectPermissionTest.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/units/Model/ProjectPermissionTest.php b/tests/units/Model/ProjectPermissionTest.php index c9e0a481..a9f8ab04 100644 --- a/tests/units/Model/ProjectPermissionTest.php +++ b/tests/units/Model/ProjectPermissionTest.php @@ -267,6 +267,29 @@ class ProjectPermissionTest extends Base $this->assertEquals(array(1), $projectPermission->getActiveProjectIds(3)); } + public function testGetProjectIds() + { + $userModel = new UserModel($this->container); + $projectModel = new ProjectModel($this->container); + $userRoleModel = new ProjectUserRoleModel($this->container); + $projectPermission = new ProjectPermissionModel($this->container); + + $this->assertEquals(2, $userModel->create(array('username' => 'user 1'))); + $this->assertEquals(3, $userModel->create(array('username' => 'user 2'))); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); + $this->assertEquals(2, $projectModel->create(array('name' => 'Project 2', 'is_active' => 0))); + + $this->assertTrue($userRoleModel->addUser(1, 2, Role::PROJECT_MEMBER)); + $this->assertTrue($userRoleModel->addUser(2, 2, Role::PROJECT_MEMBER)); + $this->assertTrue($userRoleModel->addUser(1, 3, Role::PROJECT_MEMBER)); + $this->assertTrue($userRoleModel->addUser(2, 3, Role::PROJECT_MEMBER)); + + $this->assertEmpty($projectPermission->getProjectIds(1)); + $this->assertEquals(array(1, 2), $projectPermission->getProjectIds(2)); + $this->assertEquals(array(1, 2), $projectPermission->getProjectIds(3)); + } + public function testDuplicate() { $userModel = new UserModel($this->container); |