Rajout de doctrine/orm
[zf2.biz/application_blanche.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / SequenceGeneratorTest.php
diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Functional/SequenceGeneratorTest.php
new file mode 100644 (file)
index 0000000..8a71cc1
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+
+namespace Doctrine\Tests\ORM\Functional;
+
+require_once __DIR__ . '/../../TestInit.php';
+
+/**
+ * Description of SequenceGeneratorTest
+ *
+ * @author robo
+ */
+class SequenceGeneratorTest extends \Doctrine\Tests\OrmFunctionalTestCase
+{
+    public function setUp()
+    {
+        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 SequenceEntity
+{
+    /**
+     * @Id
+     * @column(type="integer")
+     * @GeneratedValue(strategy="SEQUENCE")
+     * @SequenceGenerator(allocationSize=5,sequenceName="person_id_seq")
+     */
+    public $id;
+}
\ No newline at end of file