/** * @test */ public function thatTicketAttachmentRetrieves() { $attachment = $this->attachment(); $this->ticketRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_TICKET_ID))->will($this->returnValue($this->ticket)); $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('VIEW'), $this->equalTo($this->ticket))->will($this->returnValue(true)); $this->ticket->expects($this->once())->method('getAttachment')->with($this->equalTo(self::DUMMY_ATTACHMENT_ID))->will($this->returnValue($attachment)); $retrieveTicketAttachmentCommand = new RetrieveTicketAttachmentCommand(); $retrieveTicketAttachmentCommand->attachmentId = self::DUMMY_ATTACHMENT_ID; $retrieveTicketAttachmentCommand->ticketId = self::DUMMY_TICKET_ID; $this->ticketService->getTicketAttachment($retrieveTicketAttachmentCommand); }
/** * Retrieves Ticket Attachment * * @ApiDoc( * description="Returns a ticket attachment", * uri="/tickets/{ticketId}/attachments/{attachmentId}.{_format}", * method="GET", * resource=true, * requirements={ * { * "name"="ticketId", * "dataType"="integer", * "requirement"="\d+", * "description"="Ticket Id" * }, * { * "name"="attachmentId", * "dataType"="integer", * "requirement"="\d+", * "description"="Ticket attachment Id" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to see ticket attachment", * 404="Returned when the attachment is not found" * } * ) * * @param RetrieveTicketAttachmentCommand $command * @return \Diamante\DeskBundle\Model\Attachment\Attachment * @throws \RuntimeException if Ticket does not exists or Ticket has no particular attachment */ public function getTicketAttachment(RetrieveTicketAttachmentCommand $command) { return parent::getTicketAttachment($command); }