コード例 #1
0
 /**
  * @test
  */
 public function thatCommentDeletes()
 {
     $comment = new Comment(self::DUMMY_COMMENT_CONTENT, $this->_dummyTicket, $this->createDiamanteUser(), false);
     $comment->addAttachment(new Attachment(new File('some/path/file.ext')));
     $comment->addAttachment(new Attachment(new File('some/path/file.ext')));
     $this->commentRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_COMMENT_ID))->will($this->returnValue($comment));
     $this->commentRepository->expects($this->once())->method('remove')->with($this->equalTo($comment));
     $this->attachmentManager->expects($this->exactly(count($comment->getAttachments())))->method('deleteAttachment')->with($this->isInstanceOf('\\Diamante\\DeskBundle\\Model\\Attachment\\Attachment'));
     $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('DELETE'), $this->equalTo($comment))->will($this->returnValue(true));
     $this->service->deleteTicketComment(self::DUMMY_COMMENT_ID);
 }
コード例 #2
0
 /**
  * Delete Ticket Comment
  *
  * @ApiDoc(
  *  description="Delete comment",
  *  uri="/comments/{id}.{_format}",
  *  method="DELETE",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="id",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Comment Id"
  *      }
  *  },
  *  statusCodes={
  *      204="Returned when successful",
  *      403="Returned when the user is not authorized to delete comment",
  *      404="Returned when the comment is not found"
  *  }
  * )
  *
  * @param int $id
  */
 public function deleteTicketComment($id)
 {
     parent::deleteTicketComment($id);
 }