Example #1
0
 protected function ChangeGroupAdmin()
 {
     $groupId = $this->page->GetGroupId();
     $adminGroupId = $this->page->GetAdminGroupId();
     Log::Debug("Changing admin for groupId: %s to %s", $groupId, $adminGroupId);
     $group = $this->groupRepository->LoadById($groupId);
     $group->ChangeAdmin($adminGroupId);
     $this->groupRepository->Update($group);
 }
 public function testUpdateAddsAllNewAndRemovesAllDeletedRoles()
 {
     $roleId1 = 100;
     $roleId2 = 200;
     $roleId3 = 300;
     $groupId = 9298;
     $group = new Group($groupId, '');
     $group->WithRole($roleId1);
     $group->WithRole($roleId3);
     $group->ChangeRoles(array($roleId2, $roleId3));
     $this->repository->Update($group);
     $removeCommand = new DeleteGroupRoleCommand($groupId, $roleId1);
     $addCommand = new AddGroupRoleCommand($groupId, $roleId2);
     $this->assertTrue($this->db->ContainsCommand($removeCommand));
     $this->assertTrue($this->db->ContainsCommand($addCommand));
 }