public function testCreate()
 {
     $product = $this->dummyData->getProduct();
     $cartPriceRule = $this->dummyData->getCartPriceRule();
     $cartPriceRuleDiscount = new CartPriceRuleDiscount($product, 2);
     $cartPriceRuleDiscount->setQuantity(3);
     $cartPriceRuleDiscount->setCartPriceRule($cartPriceRule);
     $this->assertEntityValid($cartPriceRuleDiscount);
     $this->assertSame(3, $cartPriceRuleDiscount->getQuantity());
     $this->assertSame($product, $cartPriceRuleDiscount->getProduct());
     $this->assertSame($cartPriceRule, $cartPriceRuleDiscount->getCartPriceRule());
 }
Exemplo n.º 2
0
 public function addDiscount(CartPriceRuleDiscount $discount)
 {
     $discount->setCartPriceRule($this);
     $this->cartPriceRuleDiscounts[] = $discount;
 }
 /**
  * @return static
  */
 public function withProduct()
 {
     $this->entityDTO->product = $this->dtoBuilderFactory->getProductDTOBuilder($this->entity->getProduct())->withTags()->build();
     return $this;
 }