[DDC-451] Add test for UUIDGenerator
This commit is contained in:
parent
33c5f4f678
commit
d57159ad54
1 changed files with 48 additions and 0 deletions
48
tests/Doctrine/Tests/ORM/Functional/UUIDGeneratorTest.php
Normal file
48
tests/Doctrine/Tests/ORM/Functional/UUIDGeneratorTest.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
namespace Doctrine\Tests\ORM\Functional;
|
||||
|
||||
/**
|
||||
* @group DDC-451
|
||||
*/
|
||||
class UUIDGeneratorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
{
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
if ($this->_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;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue