[2.0] DDC-390 Fix SequenceGeneratorTest which wasnt testing anything before :-) Now showing that Sequence Generator works with allocation sizes larger than 1
This commit is contained in:
parent
2209c5ef30
commit
1e7ca2bd7a
@ -11,24 +11,43 @@ require_once __DIR__ . '/../../TestInit.php';
|
|||||||
*/
|
*/
|
||||||
class SequenceGeneratorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
class SequenceGeneratorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
{
|
{
|
||||||
public function testFoo()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->assertEquals(1, 1);
|
parent::setUp();
|
||||||
|
|
||||||
|
if (!$this->_em->getConnection()->getDatabasePlatform()->supportsSequences()) {
|
||||||
|
$this->markTestSkipped('Only working for Databases that support sequences.');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$this->_schemaTool->createSchema(array(
|
||||||
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\SequenceEntity'),
|
||||||
|
));
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHighAllocationSizeSequence()
|
||||||
|
{
|
||||||
|
for ($i = 0; $i < 11; $i++) {
|
||||||
|
$e = new SequenceEntity();
|
||||||
|
$this->_em->persist($e);
|
||||||
|
}
|
||||||
|
$this->_em->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Entity
|
* @Entity
|
||||||
*/
|
*/
|
||||||
class SeqUser {
|
class SequenceEntity
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @Id
|
* @Id
|
||||||
* @IdGenerator("sequence")
|
* @column(type="integer")
|
||||||
|
* @GeneratedValue(strategy="SEQUENCE")
|
||||||
|
* @SequenceGenerator(allocationSize=5,sequenceName="person_id_seq")
|
||||||
*/
|
*/
|
||||||
private $id;
|
public $id;
|
||||||
|
}
|
||||||
public function getId() {
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user