diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-12-29 18:44:21 +0100 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-12-29 18:44:21 +0100 |
commit | 178eda18872f99840937dc3d23629b5d7aa7cee0 (patch) | |
tree | e2e27f289b5620e92b1accddcea9489286a65243 /tests/units/Model | |
parent | b4c5e36ee4cbf34020eb043e54e9b7294062acee (diff) |
Add autocompletion in textarea for user mentions
Diffstat (limited to 'tests/units/Model')
-rw-r--r-- | tests/units/Model/ProjectPermissionTest.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/units/Model/ProjectPermissionTest.php b/tests/units/Model/ProjectPermissionTest.php index 6e8bbde9..035a1246 100644 --- a/tests/units/Model/ProjectPermissionTest.php +++ b/tests/units/Model/ProjectPermissionTest.php @@ -13,6 +13,33 @@ use Kanboard\Core\Security\Role; class ProjectPermissionTest extends Base { + public function testFindByUsernames() + { + $userModel = new User($this->container); + $projectModel = new Project($this->container); + $groupModel = new Group($this->container); + $groupMemberModel = new GroupMember($this->container); + $groupRoleModel = new ProjectGroupRole($this->container); + $userRoleModel = new ProjectUserRole($this->container); + $projectPermissionModel = new ProjectPermission($this->container); + + $this->assertEquals(1, $projectModel->create(array('name' => 'Project 1'))); + + $this->assertEquals(2, $userModel->create(array('username' => 'user1'))); + $this->assertEquals(3, $userModel->create(array('username' => 'user2'))); + $this->assertEquals(4, $userModel->create(array('username' => 'user3'))); + + $this->assertEquals(1, $groupModel->create('Group A')); + $this->assertTrue($groupMemberModel->addUser(1, 2)); + + $this->assertTrue($groupRoleModel->addGroup(1, 1, Role::PROJECT_MEMBER)); + $this->assertTrue($userRoleModel->addUser(1, 3, Role::PROJECT_MANAGER)); + + $this->assertEquals(array('user1', 'user2'), $projectPermissionModel->findUsernames(1, 'us')); + $this->assertEmpty($projectPermissionModel->findUsernames(1, 'a')); + $this->assertEmpty($projectPermissionModel->findUsernames(2, 'user')); + } + public function testGetQueryByRole() { $userModel = new User($this->container); |