/**
  * Deletes a object state group including all states and links to content.
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the user is not allowed to delete an object state group
  *
  * @param \eZ\Publish\API\Repository\Values\ObjectState\ObjectStateGroup $objectStateGroup
  */
 public function deleteObjectStateGroup(APIObjectStateGroup $objectStateGroup)
 {
     if ($this->repository->hasAccess('state', 'administrate') !== true) {
         throw new UnauthorizedException('state', 'administrate');
     }
     $loadedObjectStateGroup = $this->loadObjectStateGroup($objectStateGroup->id);
     $this->repository->beginTransaction();
     try {
         $this->objectStateHandler->deleteGroup($loadedObjectStateGroup->id);
         $this->repository->commit();
     } catch (Exception $e) {
         $this->repository->rollback();
         throw $e;
     }
 }
 /**
  * @covers \eZ\Publish\Core\Persistence\InMemory\ObjectStateHandler::deleteGroup
  */
 public function testDeleteGroup()
 {
     $this->handler->deleteGroup(2);
     try {
         $this->handler->loadGroup(2);
         $this->fail('Successfully loaded deleted object state group');
     } catch (NotFoundException $e) {
         // Do nothing
     }
     try {
         $this->handler->load(1);
         $this->fail('Successfully loaded one of the states from deleted object state group');
     } catch (NotFoundException $e) {
         // Do nothing
     }
     try {
         $this->handler->load(2);
         $this->fail('Successfully loaded one of the states from deleted object state group');
     } catch (NotFoundException $e) {
         // Do nothing
     }
 }