コード例 #1
0
 /**
  * @test
  */
 public function testDeleteBranchWithoutLogo()
 {
     $branch = new Branch('DUMM', 'DUMMY_NAME', 'DUMMY_DESC');
     $this->branchRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_BRANCH_ID))->will($this->returnValue($branch));
     $this->branchLogoHandler->expects($this->never())->method('remove');
     $this->branchRepository->expects($this->once())->method('remove')->with($this->equalTo($branch));
     $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('DELETE'), $this->equalTo('Entity:DiamanteDeskBundle:Branch'))->will($this->returnValue(true));
     $this->branchServiceImpl->deleteBranch(self::DUMMY_BRANCH_ID);
 }
コード例 #2
0
 /**
  * Delete Branch
  *
  * @ApiDoc(
  *  description="Delete branch",
  *  uri="/branches/{id}.{_format}",
  *  method="DELETE",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="id",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Branch Id"
  *      }
  *  },
  *  statusCodes={
  *      204="Returned when successful",
  *      403="Returned when the user is not authorized to delete branch",
  *      404="Returned when the branch is not found"
  *  }
  * )
  *
  * @param int $id
  * @return void
  */
 public function deleteBranch($id)
 {
     parent::deleteBranch($id);
 }
コード例 #3
0
 /**
  * Delete Branch
  *
  * @ApiDoc(
  *  description="Delete branch",
  *  uri="/branches/{id}.{_format}",
  *  method="DELETE",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="id",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Branch Id"
  *      }
  *  },
  *  statusCodes={
  *      204="Returned when successful",
  *      403="Returned when the user is not authorized to delete branch",
  *      404="Returned when the branch is not found",
  *      409="Branch has tickets and can't be deleted"
  *  }
  * )
  *
  * @param int $id
  * @throws BranchHasTicketsException
  */
 public function deleteBranch($id)
 {
     if (!parent::isBranchHasTickets($id)) {
         parent::deleteBranch($id);
     } else {
         throw new BranchHasTicketsException("Branch has tickets and can't be deleted");
     }
 }