diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-09-08 20:44:03 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-09-08 20:44:03 -0400 |
commit | fedf4ea2de21fcf95fc5aa942cedc7924865f160 (patch) | |
tree | d2dd83bd08de6284c737bbfab47699ed1ef1d984 /tests/units/Core/Security/RoleTest.php | |
parent | dded773749e869893a00865cf2183a7f0c684038 (diff) |
Custom project roles inherit from project members
Diffstat (limited to 'tests/units/Core/Security/RoleTest.php')
-rw-r--r-- | tests/units/Core/Security/RoleTest.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/units/Core/Security/RoleTest.php b/tests/units/Core/Security/RoleTest.php new file mode 100644 index 00000000..10b9c409 --- /dev/null +++ b/tests/units/Core/Security/RoleTest.php @@ -0,0 +1,37 @@ +<?php + +use Kanboard\Core\Security\Role; + +require_once __DIR__.'/../../Base.php'; + +class RoleTest extends Base +{ + public function testIsCustomRole() + { + $role = new Role(); + $this->assertFalse($role->isCustomProjectRole(Role::PROJECT_MANAGER)); + $this->assertFalse($role->isCustomProjectRole(Role::PROJECT_MEMBER)); + $this->assertFalse($role->isCustomProjectRole(Role::PROJECT_VIEWER)); + $this->assertFalse($role->isCustomProjectRole('')); + $this->assertTrue($role->isCustomProjectRole('Custom Role')); + } + + public function testGetRoleName() + { + $role = new Role(); + $this->assertEquals('Project Manager', $role->getRoleName(Role::PROJECT_MANAGER)); + $this->assertEquals('Project Member', $role->getRoleName(Role::PROJECT_MEMBER)); + $this->assertEquals('Project Viewer', $role->getRoleName(Role::PROJECT_VIEWER)); + $this->assertEquals('Administrator', $role->getRoleName(Role::APP_ADMIN)); + $this->assertEquals('Manager', $role->getRoleName(Role::APP_MANAGER)); + $this->assertEquals('User', $role->getRoleName(Role::APP_USER)); + $this->assertEquals('Unknown', $role->getRoleName('Foobar')); + } + + public function testGetters() + { + $role = new Role(); + $this->assertCount(3, $role->getApplicationRoles()); + $this->assertCount(3, $role->getProjectRoles()); + } +} |