public function __construct(CartItem $cartItem, DTOBuilderFactoryInterface $dtoBuilderFactory)
 {
     $this->entity = $cartItem;
     $this->dtoBuilderFactory = $dtoBuilderFactory;
     $this->entityDTO = new CartItemDTO();
     $this->setId();
     $this->setTime();
     $this->entityDTO->fullSku = $this->entity->getFullSku();
     $this->entityDTO->quantity = $this->entity->getQuantity();
     $this->entityDTO->shippingWeight = $this->entity->getShippingWeight();
 }
 public function matches(CartItem $cartItem)
 {
     if ($cartItem->getProduct()->getId() == $this->product->getId() and $cartItem->getQuantity() >= $this->quantity) {
         return true;
     }
     return false;
 }
 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;
 }
示例#4
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()));
 }