Exemplo n.º 1
0
 public function processNextCart(Cart $cart)
 {
     $this->totalPrice = 0;
     $items = $cart->getItems();
     foreach ($items as $oneItem) {
         $discountedItem = $this->discountList->createDiscountedItem($oneItem);
         $this->totalPrice += $discountedItem->getPrice();
     }
 }
Exemplo n.º 2
0
 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();
 }