public function testHandle()
 {
     $pricing = $this->dummyData->getPricing();
     $productService = $this->mockService->getProductService();
     $dtoBuilderFactory = $this->getDTOBuilderFactory();
     $request = new GetProductRequest(self::UUID_HEX);
     $response = new GetProductResponse($pricing);
     $handler = new GetProductHandler($productService, $dtoBuilderFactory);
     $handler->handle(new GetProductQuery($request, $response));
     $this->assertTrue($response->getProductDTO() instanceof ProductDTO);
     $handler->handle(new GetProductQuery($request, $response));
     $this->assertTrue($response->getProductDTOWithAllData() instanceof ProductDTO);
 }
 /**
  * @return $productDTO
  */
 protected function getDummyProduct($name = null, $isVisible = true)
 {
     $faker = \Faker\Factory::create();
     if ($name === null) {
         $name = $faker->name;
     }
     $productDTO = new ProductDTO();
     $productDTO->name = $name;
     $productDTO->description = $faker->paragraph(5);
     $productDTO->defaultImage = $faker->imageUrl();
     $productDTO->sku = $faker->randomNumber(5);
     $productDTO->unitPrice = $faker->numberBetween(100, 2000);
     $productDTO->isVisible = $isVisible;
     $productDTO->isActive = true;
     $productDTO->rating = $faker->numberBetween(100, 500);
     $productDTO->shippingWeight = $faker->numberBetween(10, 40);
     $command = new CreateProductCommand($productDTO);
     $this->dispatch($command);
     $productId = $command->getProductId()->getHex();
     $request = new GetProductRequest($productId);
     $response = new GetProductResponse($this->getPricing());
     $this->dispatchQuery(new GetProductQuery($request, $response));
     return $response->getProductDTO();
 }