/**
  * @test
  */
 public function thatAttachmentsAddsForTicket()
 {
     $ticket = new Ticket(new UniqueId('unique_id'), new TicketSequenceNumber(12), self::SUBJECT, self::DESCRIPTION, $this->createBranch(), $this->createReporter(), $this->createAssignee(), new Source(Source::PHONE), new Priority(Priority::PRIORITY_LOW), new Status(Status::CLOSED));
     $attachmentInputs = $this->attachmentInputs();
     $this->ticketRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_TICKET_ID))->will($this->returnValue($ticket));
     $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($ticket));
     $this->ticketRepository->expects($this->once())->method('store')->with($this->equalTo($ticket));
     $this->authorizationService->expects($this->once())->method('isActionPermitted')->with($this->equalTo('EDIT'), $this->equalTo($ticket))->will($this->returnValue(true));
     $addTicketAttachmentCommand = new AddTicketAttachmentCommand();
     $addTicketAttachmentCommand->attachmentsInput = $attachmentInputs;
     $addTicketAttachmentCommand->ticketId = self::DUMMY_TICKET_ID;
     $this->ticketService->addAttachmentsForTicket($addTicketAttachmentCommand);
 }
 /**
  * Adds Attachments for Ticket
  *
  * @ApiDoc(
  *  description="Add attachment to ticket",
  *  uri="/tickets/{ticketId}/attachments.{_format}",
  *  method="POST",
  *  resource=true,
  *  requirements={
  *      {
  *          "name"="ticketId",
  *          "dataType"="integer",
  *          "requirement"="\d+",
  *          "description"="Ticket Id"
  *      }
  *  },
  *  statusCodes={
  *      201="Returned when successful",
  *      403="Returned when the user is not authorized to add attachment to ticket"
  *  }
  * )
  *
  * @param AddTicketAttachmentCommand $command
  * @return array
  */
 public function addAttachmentsForTicket(AddTicketAttachmentCommand $command)
 {
     $this->prepareAttachmentInput($command);
     return parent::addAttachmentsForTicket($command);
 }