Exemple #1
0
 /**
  * @test
  * @expectedException Palmabit\Authentication\Exceptions\LoginRequiredException
  **/
 public function it_throws_exception_if_no_user_is_logged()
 {
     $order = new Order();
     $product = new Product(["description" => "desc", "code" => "code", "name" => "name", "slug" => "slug", "slug_lang" => "", "description_long" => "", "featured" => 1, "public" => 1, "offer" => 1, "stock" => 4, "video_link" => "http://www.google.com/video/12312422313", "price" => "10.00"]);
     $mock_row = m::mock('Palmabit\\Catalog\\Models\\RowOrder')->makePartial()->shouldReceive('setItem')->once()->with($product, 10)->andReturn(true)->getMock();
     $mock_row->product_id = 10;
     $mock_row->quantity = 1;
     $mock_row->total_price = 1.0;
     $order->addRow($product, 10, $mock_row);
     $order->save();
 }
Exemple #2
0
 /**
  * @param Product $product
  * @param         $quantity
  * @param null    $row_order
  */
 public function addRow(Product $product, $quantity, $row_order = null)
 {
     $this->order->addRow($product, $quantity, $row_order);
     // update the session
     Session::put($this->session_key, $this->order);
 }