From fedf4ea2de21fcf95fc5aa942cedc7924865f160 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 8 Sep 2016 20:44:03 -0400 Subject: Custom project roles inherit from project members --- tests/units/Core/Security/RoleTest.php | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/units/Core/Security/RoleTest.php (limited to 'tests/units/Core/Security/RoleTest.php') 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 @@ +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()); + } +} -- cgit v1.2.3