/** * @test */ public function thatListsTicketAttachments() { $this->ticketRepository->expects($this->once())->method('get')->with($this->equalTo(self::DUMMY_TICKET_ID))->will($this->returnValue($this->ticket)); $this->authorizationService->expects($this->exactly(2))->method('isActionPermitted')->with($this->equalTo('VIEW'), $this->equalTo($this->ticket))->will($this->returnValue(true)); $attachment = $this->attachment(); $this->ticket->expects($this->once())->method('getAttachments')->will($this->returnValue(array($attachment))); $attachments = $this->ticketService->listTicketAttachments(self::DUMMY_TICKET_ID); $this->assertNotNull($attachments); $this->assertContains($attachment, $attachments); }
/** * List Ticket attachments * * @ApiDoc( * description="Returns ticket attachments", * uri="/tickets/{id}/attachments.{_format}", * method="GET", * resource=true, * requirements={ * { * "name"="id", * "dataType"="integer", * "requirement"="\d+", * "description"="Ticket Id" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to list ticket attachments" * } * ) * * @param int $id * * @return \Doctrine\Common\Collections\ArrayCollection */ public function listTicketAttachments($id) { return parent::listTicketAttachments($id); }