public function testHasMany() { list($repo, $itemRepo) = $this->getMocks(); $instance = new CategoryHandler($repo, $itemRepo); $mockItemEntity1 = m::mock('Xpressengine\\Category\\CategoryItemEntity'); $mockItemEntity2 = m::mock('Xpressengine\\Category\\CategoryItemEntity'); $targetId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; $itemRepo->shouldReceive('hasMany')->once()->with($targetId)->andReturn([$mockItemEntity1, $mockItemEntity2]); $items = $instance->hasMany($targetId); $this->assertEquals(2, count($items)); }