Exemplo n.º 1
0
 /**
  * @Given /^(this product) is available in "([^"]+)" size priced at ("[^"]+")$/
  */
 public function thisProductIsAvailableInSize(ProductInterface $product, $optionValueName, $price)
 {
     /** @var ProductVariantInterface $variant */
     $variant = $this->productVariantFactory->createNew();
     $optionValue = $this->sharedStorage->get(sprintf('%s_option_value', $optionValueName));
     $variant->addOption($optionValue);
     $variant->setPrice($price);
     $variant->setCode(sprintf("%s_%s", $product->getCode(), $optionValueName));
     $product->addVariant($variant);
     $this->objectManager->flush();
 }