示例#1
0
 /**
  * @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;
 }
示例#2
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();
     }
 }