/**
  * @param Product $product
  * @param ProductUnit $productUnit
  * @param float $quantity
  */
 public function __construct(Product $product, ProductUnit $productUnit, $quantity)
 {
     if (!$product->getId()) {
         throw new \InvalidArgumentException('Product must have id.');
     }
     $this->product = $product;
     if (!$productUnit->getCode()) {
         throw new \InvalidArgumentException('ProductUnit must have code.');
     }
     $this->productUnit = $productUnit;
     if (!is_numeric($quantity) || $quantity < 0) {
         throw new \InvalidArgumentException('Quantity must be numeric and more than or equal zero.');
     }
     $this->quantity = $quantity;
 }
 /**
  * @param Product $product
  *
  * @return Crawler
  */
 protected function getCrawler(Product $product)
 {
     return $this->client->request('GET', $this->getUrl('orob2b_shopping_list_line_item_frontend_add_widget', ['productId' => $product->getId(), '_widgetContainer' => 'dialog', '_wid' => 'test-uuid']));
 }
Exemplo n.º 3
0
 /**
  * Set product
  *
  * @param Product $product
  * @return $this
  */
 public function setProduct(Product $product = null)
 {
     if ($product && (!$this->product || $product->getId() !== $this->product->getId())) {
         $this->requirePriceRecalculation = true;
     }
     $this->product = $product;
     return $this;
 }