public function testHandle() { $cartCalculator = $this->dummyData->getCartCalculator(); $cartService = $this->mockService->getCartService(); $dtoBuilderFactory = $this->getDTOBuilderFactory(); $request = new GetCartBySessionIdRequest(self::UUID_HEX); $response = new GetCartBySessionIdResponse($cartCalculator); $handler = new GetCartBySessionIdHandler($cartService, $dtoBuilderFactory); $handler->handle(new GetCartBySessionIdQuery($request, $response)); $this->assertTrue($response->getCartDTO() instanceof CartDTO); }
/** * @return CartDTO * @throws EntityNotFoundException */ private function getCartFromSession() { $request = new GetCartBySessionIdRequest($this->getSessionId()); $response = new GetCartBySessionIdResponse($this->getCartCalculator()); $this->dispatchQuery(new GetCartBySessionIdQuery($request, $response)); return $response->getCartDTO(); }