예제 #1
0
 /**
  * Add a product to the basket
  *
  * @param string $sku
  * @param string $name
  * @param Money $price
  * @param Closure $action
  * @return void
  */
 public function add($sku, $name, Money $price, Closure $action = null)
 {
     $product = new Product($sku, $name, $price, $this->rate);
     if ($action) {
         $product->action($action);
     }
     $this->products->add($sku, $product);
 }
예제 #2
0
 /** @test */
 public function should_add_item()
 {
     $this->collection->add(5, 'Snowball II');
     $this->assertEquals('Snowball II', $this->collection->get(5));
 }
예제 #3
0
 /**
  * Add a attribute
  *
  * @param string $key
  * @param mixed  $value
  *
  * @return void
  */
 public function attributes($key, $value)
 {
     $this->attributes->add($key, $value);
 }