Exemplo n.º 1
0
 /**
  * @param CategoryEntity $category category object
  * @param int            $amount   decrease amount
  * @return int affecting statement
  */
 public function decrement(CategoryEntity $category, $amount = 1)
 {
     return $this->repo->decrement($category, $amount);
 }
 public function testDecrement()
 {
     list($conn, $query) = $this->getMocks();
     $instance = new CategoryRepository($conn);
     $mockEntity = m::mock('Xpressengine\\Category\\CategoryEntity');
     $mockEntity->id = 1;
     $conn->shouldReceive('table')->andReturn($query);
     $query->shouldReceive('where')->once()->with('id', 1)->andReturnSelf();
     $query->shouldReceive('decrement')->once()->with('count', 1)->andReturn(1);
     $instance->decrement($mockEntity);
 }