/** * increaseCartLineQuantity with empty Cart. * * @dataProvider dataDecreaseCartLineQuantityRemove * @group cart */ public function testDecreaseCartLineQuantityRemove($initialQuantity, $quantityToIncrease) { $cart = new Cart(); $cartLine = new CartLine(); $cartLine->setCart($cart); $cartLine->setQuantity($initialQuantity); $cart->setCartLines(new ArrayCollection([$cartLine])); $this->cartManager->decreaseCartLineQuantity($cartLine, $quantityToIncrease); $this->assertEmpty($cart->getCartLines()); }
/** * Test get weight. */ public function testGetWeight() { $purchasable = $this->getMock('Elcodi\\Component\\Product\\Entity\\Interfaces\\PurchasableInterface'); $purchasable->method('getWeight')->will($this->returnValue(5)); $cartLine = new CartLine(); $cartLine->setPurchasable($purchasable); $cartLine->setQuantity(2); $this->assertEquals(10, $cartLine->getWeight()); $variant = $this->getMock('Elcodi\\Component\\Product\\Entity\\Interfaces\\VariantInterface'); $variant->method('getPurchasable')->will($this->returnValue($purchasable)); $variant->method('getWeight')->will($this->returnValue(10)); $cartLine = new CartLine(); $cartLine->setPurchasable($variant); $cartLine->setQuantity(3); $this->assertEquals(30, $cartLine->getWeight()); }