/**
  * @test
  */
 public function thatAttachmentRemovesFromComment()
 {
     $attachment = 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($this->comment));
     $this->comment->expects($this->once())->method('getAttachment')->with($this->equalTo(1))->will($this->returnValue($attachment));
     $this->comment->expects($this->once())->method('removeAttachment')->with($this->equalTo($attachment));
     $this->attachmentManager->expects($this->once())->method('deleteAttachment')->with($this->equalTo($attachment));
     $this->commentRepository->expects($this->once())->method('store')->with($this->equalTo($this->comment));
     $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('EDIT'), $this->equalTo($this->comment))->will($this->returnValue(true));
     $removeCommentAttachmentCommand = new RemoveCommentAttachmentCommand();
     $removeCommentAttachmentCommand->attachmentId = 1;
     $removeCommentAttachmentCommand->commentId = self::DUMMY_COMMENT_ID;
     $this->service->removeAttachmentFromComment($removeCommentAttachmentCommand);
 }
 /**
  * Remove Attachment from Comment
  *
  * @ApiDoc(
  *  description="Remove comment attachment",
  *  uri="/comments/{commentId}/attachments/{attachmentId}.{_format}",
  *  method="DELETE",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="commentId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Comment Id"
  *      },
  *      {
  *          "name"="attachmentId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Comment attachment Id"
  *      }
  *  },
  *  statusCodes={
  *      204="Returned when successful",
  *      403="Returned when the user is not authorized to delete attachment",
  *      404="Returned when the comment or attachment is not found"
  *  }
  * )
  *
  * @param RemoveCommentAttachmentCommand $command
  * @return void
  * @throws \RuntimeException if Comment does not exists or Comment has no particular attachment
  */
 public function removeAttachmentFromComment(RemoveCommentAttachmentCommand $command)
 {
     parent::removeAttachmentFromComment($command, true);
 }