コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
ファイル: BasketTest.php プロジェクト: dennisoderwald/basket
 /** @test */
 public function should_remove_product_from_basket()
 {
     $this->basket->remove('1');
     $this->assertEquals(0, $this->basket->count());
 }
コード例 #4
0
 /**
  * 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;
 }