From 1e7ca2bd7a8308e79a77337c76e3b522e61cf397 Mon Sep 17 00:00:00 2001 From: beberlei Date: Sat, 20 Mar 2010 17:04:46 +0000 Subject: [PATCH] [2.0] DDC-390 Fix SequenceGeneratorTest which wasnt testing anything before :-) Now showing that Sequence Generator works with allocation sizes larger than 1 --- .../ORM/Functional/SequenceGeneratorTest.php | 41 ++++++++++++++----- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php b/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php index 9177d3a45..8a71cc1f1 100644 --- a/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php @@ -11,24 +11,43 @@ require_once __DIR__ . '/../../TestInit.php'; */ class SequenceGeneratorTest extends \Doctrine\Tests\OrmFunctionalTestCase { - public function testFoo() + public function setUp() { - $this->assertEquals(1, 1); + parent::setUp(); + + if (!$this->_em->getConnection()->getDatabasePlatform()->supportsSequences()) { + $this->markTestSkipped('Only working for Databases that support sequences.'); + } + + try { + $this->_schemaTool->createSchema(array( + $this->_em->getClassMetadata(__NAMESPACE__ . '\SequenceEntity'), + )); + } catch(\Exception $e) { + + } + } + + public function testHighAllocationSizeSequence() + { + for ($i = 0; $i < 11; $i++) { + $e = new SequenceEntity(); + $this->_em->persist($e); + } + $this->_em->flush(); } } /** * @Entity */ -class SeqUser { +class SequenceEntity +{ /** * @Id - * @IdGenerator("sequence") + * @column(type="integer") + * @GeneratedValue(strategy="SEQUENCE") + * @SequenceGenerator(allocationSize=5,sequenceName="person_id_seq") */ - private $id; - - public function getId() { - return $this->id; - } -} - + public $id; +} \ No newline at end of file