Commit a87a12cc authored by Steve Müller's avatar Steve Müller

cover in test suite that platform generates inline column comment SQL

parent a4dfce29
...@@ -1027,6 +1027,55 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -1027,6 +1027,55 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
); );
} }
/**
* @group DBAL-1176
*
* @dataProvider getGeneratesInlineColumnCommentSQL
*/
public function testGeneratesInlineColumnCommentSQL($comment, $expectedSql)
{
if (! $this->_platform->supportsInlineColumnComments()) {
$this->markTestSkipped(sprintf('%s does not support inline column comments.', get_class($this->_platform)));
}
$this->assertSame($expectedSql, $this->_platform->getInlineColumnCommentSQL($comment));
}
public function getGeneratesInlineColumnCommentSQL()
{
return array(
'regular comment' => array('Regular comment', $this->getInlineColumnRegularCommentSQL()),
'comment requiring escaping' => array(
sprintf(
'Using inline comment delimiter %s works',
$this->getInlineColumnCommentDelimiter()
),
$this->getInlineColumnCommentRequiringEscapingSQL()
),
'empty comment' => array('', $this->getInlineColumnEmptyCommentSQL()),
);
}
protected function getInlineColumnCommentDelimiter()
{
return "'";
}
protected function getInlineColumnRegularCommentSQL()
{
return "COMMENT 'Regular comment'";
}
protected function getInlineColumnCommentRequiringEscapingSQL()
{
return "COMMENT 'Using inline comment delimiter '' works'";
}
protected function getInlineColumnEmptyCommentSQL()
{
return "COMMENT ''";
}
protected function getQuotedStringLiteralWithoutQuoteCharacter() protected function getQuotedStringLiteralWithoutQuoteCharacter()
{ {
return "'No quote'"; return "'No quote'";
......
...@@ -637,6 +637,26 @@ class SqlitePlatformTest extends AbstractPlatformTestCase ...@@ -637,6 +637,26 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
); );
} }
protected function getInlineColumnCommentDelimiter()
{
return "\n";
}
protected function getInlineColumnRegularCommentSQL()
{
return "--Regular comment\n";
}
protected function getInlineColumnCommentRequiringEscapingSQL()
{
return "--Using inline comment delimiter \n-- works\n";
}
protected function getInlineColumnEmptyCommentSQL()
{
return "--\n";
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
......
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