예제 #1
0
 public function testHandle()
 {
     $cartCalculator = $this->dummyData->getCartCalculator();
     $cartService = $this->mockService->getCartService();
     $dtoBuilderFactory = $this->getDTOBuilderFactory();
     $request = new GetCartRequest(self::UUID_HEX);
     $response = new GetCartResponse($cartCalculator);
     $handler = new GetCartHandler($cartService, $dtoBuilderFactory);
     $handler->handle(new GetCartQuery($request, $response));
     $this->assertTrue($response->getCartDTO() instanceof CartDTO);
     $handler->handle(new GetCartQuery($request, $response));
     $this->assertTrue($response->getCartDTOWithAllData() instanceof CartDTO);
 }
예제 #2
0
 protected function createNewCart()
 {
     $userId = null;
     if ($this->userDTO !== null) {
         $userId = $this->userDTO->id->getHex();
     }
     $createCartCommand = new CreateCartCommand($this->getRemoteIP4(), $userId, $this->getSessionId());
     $this->dispatch($createCartCommand);
     $cartId = $createCartCommand->getCartId();
     $request = new GetCartRequest($cartId);
     $response = new GetCartResponse($this->getCartCalculator());
     $this->dispatchQuery(new GetCartQuery($request, $response));
     $this->cartDTO = $response->getCartDTO();
 }