$repository = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItem');
            $items = $repository->findAll();
            expect($repository->getPrevious($items[2])->getId())->should('be', $items[1]->getId());
        });
        it('should get null when there is no previous item', function () use(&$fixtureIds) {
            $em = Project::sc()->em();
            $repository = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItem');
            $items = $repository->findAll();
            expect($repository->getPrevious($items[0]))->should('be', null);
        });
        it('should get the next item', function () use(&$fixtureIds) {
            $em = Project::sc()->em();
            $repository = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItem');
            $items = $repository->findAll();
            expect($repository->getNext($items[1])->getId())->should('be', $items[2]->getId());
        });
        it('should get the next item when there are more than one result on the database', function () use(&$fixtureIds, &$parentId) {
            $em = Project::sc()->em();
            $repository = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItem');
            $items = $repository->findAll();
            expect($repository->getNext($items[0])->getId())->should('be', $items[1]->getId());
        });
        it('should get null when there is no previous item', function () use(&$fixtureIds, &$parentId) {
            $em = Project::sc()->em();
            $repository = $em->getRepository('Gradua\\DoctrineExtensions\\OrderedItem\\ExampleEntities\\OrderedItem');
            $items = $repository->findAll();
            expect($repository->getNext($items[2]))->should('be', null);
        });
    });
});
//
Beispiel #2
0
<?php

use PSpec\PSpecSuite, System\Configurations\Project;
require_once __DIR__ . "/../../../../../class_loaders.php";
Project::init('test');
PSpecSuite::instance('/../../../../../vendor_lib/pspec/')->addParameters($_GET)->addListener(Project::srvc('DoctrineSqlLogger'))->setSpec(__DIR__ . '/specs/AllSpecs.spec.php')->runAndReport();