コード例 #1
0
 public function matches(CartItem $cartItem)
 {
     if ($cartItem->getProduct()->getId() == $this->product->getId() and $cartItem->getQuantity() >= $this->quantity) {
         return true;
     }
     return false;
 }
コード例 #2
0
 public function matches(CartItem $cartItem)
 {
     foreach ($cartItem->getProduct()->getTags() as $tag) {
         if ($tag->getId() === $this->tag->getId() and $cartItem->getQuantity() >= $this->quantity) {
             return true;
         }
     }
     return false;
 }
コード例 #3
0
 public function testCreateDefaults()
 {
     $cartItem = new CartItem();
     $this->assertSame(null, $cartItem->getQuantity());
     $this->assertSame(null, $cartItem->getProduct());
     $this->assertSame(null, $cartItem->getCart());
     $this->assertSame(0, count($cartItem->getCartItemOptionProducts()));
     $this->assertSame(0, count($cartItem->getCartItemOptionValues()));
     $this->assertSame(0, count($cartItem->getCartItemTextOptionValues()));
     $this->assertSame(0, count($cartItem->getAttachments()));
 }
コード例 #4
0
 /**
  * @return static
  */
 public function withProduct(Pricing $pricing)
 {
     $this->entityDTO->product = $this->dtoBuilderFactory->getProductDTOBuilder($this->entity->getProduct())->withTags()->withProductQuantityDiscounts($pricing)->build();
     return $this;
 }