コード例 #1
0
 /**
  * @test
  */
 public function thatAttachmentRemovesFromTicket()
 {
     $attachment = new Attachment(new File('some/path/file.ext'));
     $this->ticketRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_TICKET_ID))->will($this->returnValue($this->ticket));
     $this->ticket->expects($this->once())->method('getAttachment')->with($this->equalTo(self::DUMMY_ATTACHMENT_ID))->will($this->returnValue($attachment));
     $this->ticket->expects($this->once())->method('removeAttachment')->with($this->equalTo($attachment));
     $this->attachmentManager->expects($this->once())->method('deleteAttachment')->with($this->equalTo($attachment));
     $this->ticketRepository->expects($this->once())->method('store')->with($this->equalTo($this->ticket));
     $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('EDIT'), $this->equalTo($this->ticket))->will($this->returnValue(true));
     $this->ticket->expects($this->once())->method('getRecordedEvents')->will($this->returnValue(array()));
     $removeTicketAttachmentCommand = new RemoveTicketAttachmentCommand();
     $removeTicketAttachmentCommand->ticketId = self::DUMMY_TICKET_ID;
     $removeTicketAttachmentCommand->attachmentId = self::DUMMY_ATTACHMENT_ID;
     $this->ticketService->removeAttachmentFromTicket($removeTicketAttachmentCommand);
 }
コード例 #2
0
 /**
  * Remove Attachment from Ticket
  *
  * @ApiDoc(
  *  description="Remove ticket attachment",
  *  uri="/tickets/{ticketId}/attachments/{attachmentId}.{_format}",
  *  method="DELETE",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="ticketId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Ticket Id"
  *      },
  *      {
  *          "name"="attachmentId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Attachment Id"
  *      }
  *  },
  *  statusCodes={
  *      204="Returned when successful",
  *      403="Returned when the user is not authorized to delete attachment",
  *      404="Returned when the ticket or attachment is not found"
  *  }
  * )
  *
  * @param RemoveTicketAttachmentCommand $command
  * @param boolean $flush
  *
  * @return \Diamante\DeskBundle\Model\Ticket\TicketKey
  * @throws \RuntimeException if Ticket does not exists or Ticket has no particular attachment
  */
 public function removeAttachmentFromTicket(RemoveTicketAttachmentCommand $command, $flush = false)
 {
     return parent::removeAttachmentFromTicket($command, true);
 }
コード例 #3
0
 /**
  * Remove Attachment from Ticket
  *
  * @ApiDoc(
  *  description="Remove ticket attachment",
  *  uri="/tickets/{ticketId}/attachments/{attachmentId}.{_format}",
  *  method="DELETE",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="ticketId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Ticket Id"
  *      },
  *      {
  *          "name"="attachmentId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Attachment Id"
  *      }
  *  },
  *  statusCodes={
  *      204="Returned when successful",
  *      403="Returned when the user is not authorized to delete attachment",
  *      404="Returned when the ticket or attachment is not found"
  *  }
  * )
  *
  * @param RemoveTicketAttachmentCommand $command
  * @return string $ticketKey
  * @throws \RuntimeException if Ticket does not exists or Ticket has no particular attachment
  */
 public function removeAttachmentFromTicket(RemoveTicketAttachmentCommand $command)
 {
     return parent::removeAttachmentFromTicket($command);
 }