コード例 #1
0
 public function testIsGroupAdminIfAtLeastOneGroupHasResourceAdminRole()
 {
     $userId = 123;
     $expectedIsAdmin = true;
     $groups = array(new UserGroup(1, null, null, RoleLevel::APPLICATION_ADMIN), new UserGroup(3, null, null, RoleLevel::GROUP_ADMIN));
     $user = new User();
     $user->WithGroups($groups);
     $actualIsAdmin = $this->authorizationService->IsGroupAdministrator($user);
     $this->assertEquals($expectedIsAdmin, $actualIsAdmin);
 }
コード例 #2
0
ファイル: UserTests.php プロジェクト: utn-frm-si/booked
 public function testIsGroupAdminForGroup()
 {
     $user = new User();
     $user->WithOwnedGroups(array(new UserGroup(1, 'g1'), new UserGroup(2, 'g2')));
     $user->WithGroups(array(new UserGroup(4, 'g4'), new UserGroup(5, 'g5')));
     $this->assertTrue($user->IsGroupAdminFor(1));
     $this->assertTrue($user->IsGroupAdminFor(2));
     $this->assertFalse($user->IsGroupAdminFor(4));
     $this->assertFalse($user->IsGroupAdminFor(5));
 }