static function threeNonSequencialItems(EntityManager $em)
 {
     $i1 = OrderedItem::build('i 1');
     $i2 = OrderedItem::build('i 2');
     $i3 = OrderedItem::build('i 3');
     $i4 = OrderedItem::build('i 4');
     $repo = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItem');
     //        $em->persist($i1);
     //        $em->persist($i2);
     //        $em->persist($i3);
     //        $em->persist($i4);
     // persist is working fine, but I´m not sure if I can expect prePersist
     // to be allways called in sequence.
     $repo->addLast($i1);
     $repo->addLast($i2);
     $repo->addLast($i3);
     $repo->addLast($i4);
     $em->flush();
     $em->remove($i3);
     $em->flush();
     return array($i1->getId(), $i2->getId(), $i4->getId());
 }
         $i1 = $repo->find($fixtureIds[0]);
         $item = OrderedItem::build('o');
         $repo->addBefore($item, $i1);
         $em->flush();
         $items = $repo->findAll();
         expect($items[0]->getId())->should('be', $item->getId());
         expect($items[1]->getId())->should('be', $fixtureIds[0]);
         expect($items[2]->getId())->should('be', $fixtureIds[1]);
         expect($items[3]->getId())->should('be', $fixtureIds[2]);
     });
     it('should add one item after the last ', function () {
         $em = Project::sc()->em();
         $repo = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItem');
         $fixtureIds = OrderedItemFixtures::threeNonSequencialItems($em);
         $i3 = $repo->find($fixtureIds[2]);
         $item = OrderedItem::build('o');
         $repo->addAfter($item, $i3);
         $em->flush();
         $items = $repo->findAll();
         expect($items[0]->getId())->should('be', $fixtureIds[0]);
         expect($items[1]->getId())->should('be', $fixtureIds[1]);
         expect($items[2]->getId())->should('be', $fixtureIds[2]);
         expect($items[3]->getId())->should('be', $item->getId());
     });
 });
 describe('getPrevious() and getNext()', function () {
     $fixtureIds = null;
     beforeEach(function () use(&$fixtureIds) {
         Project::sc()->createService('EntityManager');
         $em = Project::sc()->em();
         $em->beginTransaction();