/** * @test */ public function thatCommentRetrieves() { $ticket = $this->_dummyTicket; $author = new User(self::DUMMY_USER_ID, User::TYPE_DIAMANTE); $comment = new Comment(self::DUMMY_COMMENT_CONTENT, $ticket, $author, false); $this->commentRepository->expects($this->once())->method('get')->with(self::DUMMY_COMMENT_ID)->will($this->returnValue($comment)); $this->authorizationService->expects($this->once())->method('isActionPermitted')->with('VIEW', $comment)->will($this->returnValue(true)); $result = $this->service->loadComment(self::DUMMY_COMMENT_ID); $this->assertEquals($comment, $result); }
/** * Load Comment by given comment id * * @ApiDoc( * description="Returns a comment", * uri="/comments/{id}.{_format}", * method="GET", * resource=true, * requirements={ * { * "name"="id", * "dataType"="integer", * "requirement"="\d+", * "description"="Comment Id" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to see comment", * 404="Returned when the comment is not found" * } * ) * * @param int $id * @return \Diamante\DeskBundle\Model\Ticket\Comment */ public function loadComment($id) { return parent::loadComment($id); }
/** * Retrieves comment author data based on typed ID provided * * @ApiDoc( * description="Returns person data", * uri="/comment/{id}/author.{_format}", * method="GET", * resource=true, * requirements={ * { * "name"="id", * "dataType"="integer", * "requirement"="\d+", * "description"="Author Id" * } * }, * statusCodes={ * 200="Returned when successful", * 403="Returned when the user is not authorized to view tickets" * } * ) * * @param $id * @return array */ public function getAuthorData($id) { $comment = parent::loadComment($id); $details = $this->userService->fetchUserDetails($comment->getAuthor()); return $details; }