public function testIncrement() { 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('increment')->once()->with('count', 1)->andReturn(1); $instance->increment($mockEntity); }
/** * Increment count has items * * @param CategoryEntity $category category object * @param int $amount increase amount * @return int affecting statement */ public function increment(CategoryEntity $category, $amount = 1) { return $this->repo->increment($category, $amount); }