1
0
mirror of synced 2025-02-03 13:59:27 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Functional/UUIDGeneratorTest.php
2016-05-11 03:00:44 +07:00

50 lines
1.0 KiB
PHP

<?php
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\Tests\OrmFunctionalTestCase;
/**
* @group DDC-451
*/
class UUIDGeneratorTest extends 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;
}
}