Commit 49df3598 authored by Marco Pivetta's avatar Marco Pivetta

Adding failing test for FK generation logic

parent 63b7ef12
...@@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\TableDiff; ...@@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\TableDiff;
abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
{ {
/** /**
* @var Doctrine\DBAL\Platforms\AbstractPlatform * @var \Doctrine\DBAL\Platforms\AbstractPlatform
*/ */
protected $_platform; protected $_platform;
...@@ -156,6 +156,21 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -156,6 +156,21 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this->assertEquals($this->getGenerateConstraintForeignKeySql(), $sql); $this->assertEquals($this->getGenerateConstraintForeignKeySql(), $sql);
} }
public function testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys()
{
$fk = new \Doctrine\DBAL\Schema\ForeignKeyConstraint(array('fk_name'), 'foreign', array('id'), 'constraint_fk');
if ($this->_platform->supportsForeignKeyConstraints()) {
$this->assertInternalType(
'string',
$this->_platform->getCreateForeignKeySQL($fk, 'test')
);
} else {
$this->setExpectedException('Doctrine\DBAL\DBALException');
$this->_platform->getCreateForeignKeySQL($fk, 'test');
}
}
protected function getBitAndComparisonExpressionSql($value1, $value2) protected function getBitAndComparisonExpressionSql($value1, $value2)
{ {
return '(' . $value1 . ' & ' . $value2 . ')'; return '(' . $value1 . ' & ' . $value2 . ')';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment