Skip to content

Commit

Permalink
Merge pull request #1266 from Ocramius/hotfix/fix-schema-generation-i…
Browse files Browse the repository at this point in the history
…n-tests-on-pgsql

[2.4] Fix schema generation in the test suite
  • Loading branch information
Ocramius committed Jan 22, 2015
2 parents ee9aebf + 56c5cb4 commit ec84953
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

class PostgreSqlSchemaToolTest extends \Doctrine\Tests\OrmFunctionalTestCase
{
protected function setUp() {
protected function setUp()
{
parent::setUp();

if ($this->_em->getConnection()->getDatabasePlatform()->getName() !== 'postgresql') {
$this->markTestSkipped('The ' . __CLASS__ .' requires the use of postgresql.');
}
Expand All @@ -19,6 +21,7 @@ protected function setUp() {
public function testPostgresMetadataSequenceIncrementedBy10()
{
$address = $this->_em->getClassMetadata('Doctrine\Tests\Models\CMS\CmsAddress');

$this->assertEquals(1, $address->sequenceGeneratorDefinition['allocationSize']);
}

Expand Down Expand Up @@ -97,7 +100,9 @@ public function testGetDropSchemaSql()
$sql = $tool->getDropSchemaSQL($classes);

$this->assertEquals(14, count($sql));

$dropSequenceSQLs = 0;

foreach ($sql AS $stmt) {
if (strpos($stmt, "DROP SEQUENCE") === 0) {
$dropSequenceSQLs++;
Expand All @@ -115,10 +120,6 @@ public function testUpdateSchemaWithPostgreSQLSchema()
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1657Screen'),
$this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1657Avatar'),
);
try {
$this->_em->getConnection()->exec("CREATE SCHEMA stonewood");
} catch(\Exception $e) {
}

$tool = new SchemaTool($this->_em);
$tool->createSchema($classes);
Expand Down
1 change: 1 addition & 0 deletions tests/Doctrine/Tests/ORM/Functional/Ticket/DDC1360Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function testSchemaDoubleQuotedCreate()
));

$this->assertEquals(array(
'CREATE SCHEMA user',
'CREATE TABLE "user"."user" (id INT NOT NULL, PRIMARY KEY(id))',
'CREATE SEQUENCE "user"."user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1',
), $sql);
Expand Down

0 comments on commit ec84953

Please sign in to comment.