1
0
mirror of synced 2024-12-14 07:06:04 +03:00

DDC-2476 Commented check under PostgreSQL.

This commit is contained in:
Guilherme Blanco 2013-06-12 02:29:08 -04:00
parent 3d86c82a7f
commit b15758bb42

View File

@ -3,6 +3,7 @@
namespace Doctrine\Tests\ORM\Functional;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
class DatabaseDriverTest extends DatabaseDriverTestCase
{
@ -153,6 +154,7 @@ class DatabaseDriverTest extends DatabaseDriverTestCase
}
$table = new \Doctrine\DBAL\Schema\Table("dbdriver_foo");
$table->addColumn('id', 'integer', array('unsigned' => true));
$table->setPrimaryKey(array('id'));
$table->addColumn('column_unsigned', 'integer', array('unsigned' => true));
@ -167,11 +169,13 @@ class DatabaseDriverTest extends DatabaseDriverTestCase
$table->addColumn('column_unique_index1', 'string');
$table->addColumn('column_unique_index2', 'string');
$table->addUniqueIndex(array('column_unique_index1', 'column_unique_index2'), 'unique_index1');
$this->_sm->dropAndCreateTable($table);
$metadatas = $this->extractClassMetadata(array("DbdriverFoo"));
$this->assertArrayHasKey('DbdriverFoo', $metadatas);
$metadata = $metadatas['DbdriverFoo'];
$this->assertArrayHasKey('id', $metadata->fieldMappings);
@ -179,8 +183,12 @@ class DatabaseDriverTest extends DatabaseDriverTestCase
$this->assertEquals('id', strtolower($metadata->fieldMappings['id']['columnName']));
$this->assertEquals('integer', (string) $metadata->fieldMappings['id']['type']);
// FIXME: Condition here is fugly.
// NOTE: PostgreSQL does not support UNSIGNED
if ( ! $this->_em->getConnection()->getDatabasePlatform() instanceof PostgreSqlPlatform) {
$this->assertArrayHasKey('columnUnsigned', $metadata->fieldMappings);
$this->assertTrue($metadata->fieldMappings['columnUnsigned']['unsigned']);
}
$this->assertArrayHasKey('columnComment', $metadata->fieldMappings);
$this->assertEquals('test_comment', $metadata->fieldMappings['columnComment']['comment']);
@ -193,9 +201,15 @@ class DatabaseDriverTest extends DatabaseDriverTestCase
$this->assertEquals(3, $metadata->fieldMappings['columnDecimal']['scale']);
$this->assertTrue( ! empty($metadata->table['indexes']['index1']['columns']));
$this->assertEquals(array('column_index1','column_index2'),$metadata->table['indexes']['index1']['columns']);
$this->assertEquals(
array('column_index1','column_index2'),
$metadata->table['indexes']['index1']['columns']
);
$this->assertTrue( ! empty($metadata->table['uniqueConstraints']['unique_index1']['columns']));
$this->assertEquals(array('column_unique_index1','column_unique_index2'),$metadata->table['uniqueConstraints']['unique_index1']['columns']);
$this->assertEquals(
array('column_unique_index1', 'column_unique_index2'),
$metadata->table['uniqueConstraints']['unique_index1']['columns']
);
}
}