public function testGetTree()
 {
     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;
     $mockItemEntity1->shouldReceive('hasChild')->andReturn(false);
     $mockItemEntity2 = m::mock('Xpressengine\\Category\\CategoryItemEntity');
     $mockItemEntity2->ordering = 1;
     $mockItemEntity2->shouldReceive('hasChild')->andReturn(false);
     $mockTreeCollection = m::mock('Xpressengine\\Support\\Tree\\TreeCollection');
     $mockTreeCollection->shouldReceive('getNodes')->once()->andReturn([$mockItemEntity1]);
     $mockTreeCollection->shouldReceive('getNodes')->once()->andReturn([$mockItemEntity2]);
     $itemRepo->shouldReceive('fetchProgenitor')->once()->with(1)->andReturn([$mockItemEntity1, $mockItemEntity2]);
     $itemRepo->shouldReceive('fetchTree')->once()->with($mockItemEntity1)->andReturn($mockTreeCollection);
     $itemRepo->shouldReceive('fetchTree')->once()->with($mockItemEntity2)->andReturn($mockTreeCollection);
     $tree = $instance->getTree($mockEntity);
     $this->assertInstanceOf('Xpressengine\\Support\\Tree\\TreeCollection', $tree);
 }