3 namespace Doctrine\Tests\ORM\Id;
5 use Doctrine\ORM\Id\SequenceGenerator;
7 require_once __DIR__ . '/../../TestInit.php';
10 * Description of SequenceGeneratorTest
14 class SequenceGeneratorTest extends \Doctrine\Tests\OrmTestCase
19 protected function setUp()
21 $this->_em = $this->_getTestEntityManager();
22 $this->_seqGen = new SequenceGenerator('seq', 10);
25 public function testGeneration()
27 for ($i=0; $i < 42; ++$i) {
29 $this->_em->getConnection()->setFetchOneResult((int)($i / 10) * 10);
31 $id = $this->_seqGen->generate($this->_em, null);
32 $this->assertEquals($i, $id);
33 $this->assertEquals((int)($i / 10) * 10 + 10, $this->_seqGen->getCurrentMaxValue());
34 $this->assertEquals($i + 1, $this->_seqGen->getNextValue());