diff options
author | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
---|---|---|
committer | Teamjungla{CODE} <junglacode@gmail.com> | 2016-08-20 13:47:12 -0500 |
commit | fe8e9cdcfe3afc1475c7e7f4392d2b2cc601a12b (patch) | |
tree | 001403874e9e3716de7c6d51a9f536e9b3c3be5e /tests/units/Model/ProjectPermissionTest.php | |
parent | b1e795fc5b45369f7b9b565b1e106d2673361977 (diff) | |
parent | 98efcf21e355ed6ac3827058b99df86ca67c75bb (diff) |
Merge branch 'stable' of https://github.com/kanboard/kanboard
Diffstat (limited to 'tests/units/Model/ProjectPermissionTest.php')
-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); |