Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / SequenceGeneratorTest.php
1 <?php
2
3 namespace Doctrine\Tests\ORM\Functional;
4
5 require_once __DIR__ . '/../../TestInit.php';
6
7 /**
8  * Description of SequenceGeneratorTest
9  *
10  * @author robo
11  */
12 class SequenceGeneratorTest extends \Doctrine\Tests\OrmFunctionalTestCase
13 {
14     public function setUp()
15     {
16         parent::setUp();
17
18         if (!$this->_em->getConnection()->getDatabasePlatform()->supportsSequences()) {
19             $this->markTestSkipped('Only working for Databases that support sequences.');
20         }
21
22         try {
23             $this->_schemaTool->createSchema(array(
24                 $this->_em->getClassMetadata(__NAMESPACE__ . '\SequenceEntity'),
25             ));
26         } catch(\Exception $e) {
27
28         }
29     }
30
31     public function testHighAllocationSizeSequence()
32     {
33         for ($i = 0; $i < 11; $i++) {
34             $e = new SequenceEntity();
35             $this->_em->persist($e);
36         }
37         $this->_em->flush();
38     }
39 }
40
41 /**
42  * @Entity
43  */
44 class SequenceEntity
45 {
46     /**
47      * @Id
48      * @column(type="integer")
49      * @GeneratedValue(strategy="SEQUENCE")
50      * @SequenceGenerator(allocationSize=5,sequenceName="person_id_seq")
51      */
52     public $id;
53 }