public function testGet()
 {
     list($repo, $itemRepo) = $this->getMocks();
     $instance = new CategoryHandler($repo, $itemRepo);
     $mockEntity = m::mock('Xpressengine\\Category\\CategoryEntity');
     $repo->shouldReceive('find')->once()->with(1)->andReturn($mockEntity);
     $category = $instance->get(1);
     $this->assertInstanceOf('Xpressengine\\Category\\CategoryEntity', $category);
 }
 public function children(CategoryHandler $handler, $categoryId)
 {
     $parentId = Input::get('id');
     if ($parentId === null) {
         $category = $handler->get($categoryId);
         $children = $handler->progenitors($category);
     } else {
         if (!($parent = $handler->getItem($parentId))) {
             throw new InvalidArgumentHttpException();
         }
         $children = $handler->children($parent);
     }
     return Presenter::makeApi($children);
 }