public function testDelete()
 {
     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('delete')->andReturn(1);
     $instance->delete($mockEntity);
 }
Example #2
0
 /**
  * Remove category
  *
  * @param CategoryEntity $category category object
  * @return int affecting statement
  */
 public function remove(CategoryEntity $category)
 {
     return $this->repo->delete($category);
 }