Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / orm / tests / Doctrine / Tests / ORM / Functional / UUIDGeneratorTest.php
1 <?php
2 namespace Doctrine\Tests\ORM\Functional;
3
4 /**
5  * @group DDC-451
6  */
7 class UUIDGeneratorTest extends \Doctrine\Tests\OrmFunctionalTestCase
8 {
9     public function setUp()
10     {
11         parent::setUp();
12
13         if ($this->_em->getConnection()->getDatabasePlatform()->getName() != 'mysql') {
14             $this->markTestSkipped('Currently restricted to MySQL platform.');
15         }
16
17         $this->_schemaTool->createSchema(array(
18             $this->_em->getClassMetadata(__NAMESPACE__ . '\\UUIDEntity')
19         ));
20     }
21
22     public function testGenerateUUID()
23     {
24         $entity = new UUIDEntity();
25
26         $this->_em->persist($entity);
27         $this->assertNotNull($entity->getId());
28         $this->assertTrue(strlen($entity->getId()) > 0);
29     }
30 }
31
32 /**
33  * @Entity
34  */
35 class UUIDEntity
36 {
37     /** @Id @Column(type="string") @GeneratedValue(strategy="UUID") */
38     private $id;
39     /**
40      * Get id.
41      *
42      * @return id.
43      */
44     public function getId()
45     {
46         return $this->id;
47     }
48 }