/**
  * @test
  */
 public function thatAddsCommentAttachment()
 {
     $comment = new Comment(self::DUMMY_COMMENT_CONTENT, $this->_dummyTicket, $this->createDiamanteUser(), false);
     $attachmentInputs = $this->attachmentInputs();
     $this->commentRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_COMMENT_ID))->will($this->returnValue($comment));
     $this->attachmentManager->expects($this->exactly(count($attachmentInputs)))->method('createNewAttachment')->with($this->isType(\PHPUnit_Framework_Constraint_IsType::TYPE_STRING), $this->isType(\PHPUnit_Framework_Constraint_IsType::TYPE_STRING), $this->equalTo($comment));
     $this->commentRepository->expects($this->once())->method('store')->with($comment);
     $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('EDIT'), $this->equalTo($comment))->will($this->returnValue(true));
     $command = new AddCommentAttachmentCommand();
     $command->attachmentsInput = $attachmentInputs;
     $command->commentId = self::DUMMY_COMMENT_ID;
     $this->service->addCommentAttachment($command);
 }
 /**
  * Add Attachments to Comment
  *
  * @ApiDoc(
  *  description="Add attachment to comment",
  *  uri="/comments/{commentId}/attachments.{_format}",
  *  method="POST",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="commentId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Comment Id"
  *      }
  *  },
  *  statusCodes={
  *      201="Returned when successful",
  *      403="Returned when the user is not authorized to add attachment to comment"
  *  }
  * )
  *
  * @param Command\AddCommentAttachmentCommand $command
  * @param $flush
  * @return array
  */
 public function addCommentAttachment(Command\AddCommentAttachmentCommand $command, $flush = false)
 {
     $this->prepareAttachmentInput($command);
     return parent::addCommentAttachment($command, true);
 }
 /**
  * Add Attachments to Comment
  *
  * @ApiDoc(
  *  description="Add attachment to comment",
  *  uri="/comments/{commentId}/attachments.{_format}",
  *  method="POST",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="commentId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Comment Id"
  *      }
  *  },
  *  statusCodes={
  *      201="Returned when successful",
  *      403="Returned when the user is not authorized to add attachment to comment"
  *  }
  * )
  *
  * @param Command\AddCommentAttachmentCommand $command
  * @return array
  */
 public function addCommentAttachment(Command\AddCommentAttachmentCommand $command)
 {
     $this->prepareAttachmentInput($command);
     return parent::addCommentAttachment($command);
 }