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); }