expect($repository->getNext($items[0])->getId())->should('be equals', $items[1]->getId()); }); it('should get null when there is no next item', function () { $em = Project::srvc('EntityManager'); $parent = OrderedItemWithParentRelation::build('parent', null); $repository = $em->getRepository('OrderedItem\\ExampleEntities\\OrderedItemWithParentRelation'); $repository->addLast($parent); $fixtureIds = OrderedItemWithParentRelationFixtures::threeItems($em, $parent); $items = $repository->findAllByParent($parent); expect($repository->getNext($items[2]))->should('be null'); }); }); describe('integrated extra tests', function () { $fixtureIds = null; beforeEach(function () use(&$fixtureIds) { Project::sc()->createService('EntityManager'); $em = Project::srvc('EntityManager'); $em->beginTransaction(); $repo = $em->getRepository('OrderedItem\\ExampleEntities\\OrderedItemWithParentRelation'); $parent = OrderedItemWithParentRelation::build('parent', null); $repo->addFirst($parent); $em->flush(); $fixtureIds = OrderedItemWithParentRelationFixtures::threeItems($em, $parent); }); afterEach(function () use(&$fixtureIds) { Project::srvc('EntityManager')->rollback(); }); it('should add three child items and allow to get a previous one', function () use(&$fixtureIds) { $em = Project::srvc('EntityManager'); $repo = $em->getRepository('OrderedItem\\ExampleEntities\\OrderedItemWithParentRelation'); $f1 = $repo->find($fixtureIds[0]);