public function testCountByCategory()
 {
     list($repo, $itemRepo) = $this->getMocks();
     $instance = new CategoryHandler($repo, $itemRepo);
     $mockEntity = m::mock('Xpressengine\\Category\\CategoryEntity');
     $mockEntity->id = 1;
     $mockItemEntity1 = m::mock('Xpressengine\\Category\\CategoryItemEntity');
     $mockItemEntity1->ordering = 0;
     $mockItemEntity2 = m::mock('Xpressengine\\Category\\CategoryItemEntity');
     $mockItemEntity1->ordering = 1;
     $itemRepo->shouldReceive('fetchProgenitor')->once()->with(1)->andReturn([$mockItemEntity1, $mockItemEntity2]);
     $itemRepo->shouldReceive('count')->once()->with($mockItemEntity1, 1)->andReturn(2);
     $itemRepo->shouldReceive('count')->once()->with($mockItemEntity2, 1)->andReturn(3);
     $count = $instance->countByCategory($mockEntity, 2);
     $this->assertEquals(7, $count);
 }