/** * @dataProvider dataForCreate */ public function testPriceDiscount($productName, $quantity, $expectedPrice) { $item = new CartItem($this->factory->getProduct($productName), $quantity); $this->cart->addCartItem($item); $this->cashier->processNextCart($this->cart); $this->assertEquals(number_format($expectedPrice, 2), $this->cashier->getTotalPrice()); }
/** * @param $cart * * @depends testEmpty */ public function testAddProduct(Cart $cart) { $cart->addCartItem(new CartItem($this->productFactory->getProduct('Apple'), 3)); $appleItems = $cart->getItems(); $this->assertInstanceOf('Kata\\H03Supermarket\\Concrete\\CartItem', $appleItems[0]); return $appleItems; }