public function processNextCart(Cart $cart) { $this->totalPrice = 0; $items = $cart->getItems(); foreach ($items as $oneItem) { $discountedItem = $this->discountList->createDiscountedItem($oneItem); $this->totalPrice += $discountedItem->getPrice(); } }
public function setUp() { $discountFactory = new DiscountFactory(); $discountList = new DiscountList(); $discountList->addDiscount($discountFactory->createPriceDiscountAboveQuantity('Apple', 5, 7)); $discountList->addDiscount($discountFactory->createQuantityDiscountAboveQuantity('Starship', 2, 1)); $this->cart = new Cart(); $this->cashier = new Cashier($discountList); $this->factory = new ProductFactory(); }