public function testParent() { list($repo, $itemRepo) = $this->getMocks(); $instance = new CategoryHandler($repo, $itemRepo); $mockItemEntity = m::mock('Xpressengine\\Category\\CategoryItemEntity'); $mockAncestor1 = m::mock('Xpressengine\\Category\\CategoryItemEntity'); $mockAncestor2 = m::mock('Xpressengine\\Category\\CategoryItemEntity'); $itemRepo->shouldReceive('fetchAsc')->once()->with($mockItemEntity, 1)->andReturn([$mockAncestor1, $mockAncestor2]); $parent = $instance->parent($mockItemEntity); $this->assertEquals($mockAncestor1, $parent); }