public function createAction(Request $request) : Response
 {
     /** @var CommentDto $commentDto */
     $commentDto = $this->dtoFactory->makeDto($request);
     $this->validationHandler->validate($commentDto);
     $commentDto = $this->createHandler->create($commentDto);
     return $this->responseFactory->makeResponse($commentDto, Response::HTTP_CREATED);
 }
 public function testCreateAction()
 {
     $this->dtoFactory->shouldReceive('makeDto')->with($this->request)->once()->andReturn($this->commentDto);
     $this->validationHandler->shouldReceive('validate')->with($this->commentDto)->once();
     $this->createHandler->shouldReceive('create')->with($this->commentDto)->once()->andReturn($this->createdCommentDto);
     $this->responseFactory->shouldReceive('makeResponse')->once();
     $this->createController->createAction($this->request);
 }
 public function testRemoveAction()
 {
     $this->deleteHandler->shouldReceive('delete')->with(self::COMMENT_ID)->once();
     $this->responseFactory->shouldReceive('makeResponse')->once();
     $this->removeController->removeAction(self::COMMENT_ID);
 }
 public function removeAction(int $commentId) : Response
 {
     $this->deleteHandler->delete($commentId);
     return $this->responseFactory->makeResponse();
 }
 public function listAction(int $postId) : JsonResponse
 {
     $comments = $this->commentRepository->getCommentsByPostId($postId);
     $dtoComments = $this->commentsMapper->transformCollection($comments);
     return $this->responseFactory->makeResponse($dtoComments);
 }