/** * Generate the Meta Data * * @param Basket $basket * @return mixed */ public function generate(Basket $basket) { $total = new Money(0, $basket->currency()); foreach ($basket->products() as $product) { $total = $total->add($this->reconciler->value($product)); } return $total; }
/** * Generate the Meta Data * * @param Basket $basket * @return mixed */ public function generate(Basket $basket) { $total = 0; foreach ($basket->products() as $product) { $total = $total + $product->quantity; } return $total; }
/** @test */ public function should_remove_product_from_basket() { $this->basket->remove('1'); $this->assertEquals(0, $this->basket->count()); }
/** * Add Product Nine * * @param Basket $basket * @return Basket */ private function addProductNine(Basket $basket) { $nine = $this->products->nine(); $basket->add($nine->sku, $nine->name, $nine->price, function ($product) use($nine) { $product->quantity($nine->quantity); $product->freebie($nine->freebie); $product->delivery($nine->delivery); }); return $basket; }