diff --git a/tests/Doctrine/Tests/ORM/Functional/UUIDGeneratorTest.php b/tests/Doctrine/Tests/ORM/Functional/UUIDGeneratorTest.php new file mode 100644 index 000000000..5fa237ee4 --- /dev/null +++ b/tests/Doctrine/Tests/ORM/Functional/UUIDGeneratorTest.php @@ -0,0 +1,48 @@ +_em->getConnection()->getDatabasePlatform()->getName() != 'mysql') { + $this->markTestSkipped('Currently restricted to MySQL platform.'); + } + + $this->_schemaTool->createSchema(array( + $this->_em->getClassMetadata(__NAMESPACE__ . '\\UUIDEntity') + )); + } + + public function testGenerateUUID() + { + $entity = new UUIDEntity(); + + $this->_em->persist($entity); + $this->assertNotNull($entity->getId()); + $this->assertTrue(strlen($entity->getId()) > 0); + } +} + +/** + * @Entity + */ +class UUIDEntity +{ + /** @Id @Column(type="string") @GeneratedValue(strategy="UUID") */ + private $id; + /** + * Get id. + * + * @return id. + */ + public function getId() + { + return $this->id; + } +}