Test default value declaration for the date type

It was not covered, probably because it was hard to do something
generic. I choose to duplicate some tests instead, so that things stay
relatively simple.
parent 24b4ebf0
......@@ -563,6 +563,20 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
}
}
public function testGetDefaultValueDeclarationSQLForDateType()
{
$currentDateSql = $this->_platform->getCurrentDateSQL();
$field = array(
'type' => Type::getType('date'),
'default' => $currentDateSql,
);
$this->assertEquals(
' DEFAULT '.$currentDateSql,
$this->_platform->getDefaultValueDeclarationSQL($field)
);
}
/**
* @group DBAL-45
*/
......
......@@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Types\Type;
class SQLServer2008PlatformTest extends AbstractSQLServerPlatformTestCase
{
......@@ -19,4 +20,18 @@ class SQLServer2008PlatformTest extends AbstractSQLServerPlatformTestCase
array())
);
}
public function testGetDefaultValueDeclarationSQLForDateType()
{
$currentDateSql = $this->_platform->getCurrentDateSQL();
$field = array(
'type' => Type::getType('date'),
'default' => $currentDateSql,
);
$this->assertEquals(
" DEFAULT '".$currentDateSql."'",
$this->_platform->getDefaultValueDeclarationSQL($field)
);
}
}
......@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Types\Type;
class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
{
......@@ -371,4 +372,18 @@ class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
$sql = $this->_platform->modifyLimitQuery($querySql, 10);
self::assertEquals($expectedSql, $sql);
}
public function testGetDefaultValueDeclarationSQLForDateType()
{
$currentDateSql = $this->_platform->getCurrentDateSQL();
$field = array(
'type' => Type::getType('date'),
'default' => $currentDateSql,
);
$this->assertEquals(
" DEFAULT '".$currentDateSql."'",
$this->_platform->getDefaultValueDeclarationSQL($field)
);
}
}
......@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Types\Type;
class SQLServerPlatformTest extends AbstractSQLServerPlatformTestCase
{
......@@ -58,4 +59,17 @@ class SQLServerPlatformTest extends AbstractSQLServerPlatformTestCase
);
}
public function testGetDefaultValueDeclarationSQLForDateType()
{
$currentDateSql = $this->_platform->getCurrentDateSQL();
$field = array(
'type' => Type::getType('date'),
'default' => $currentDateSql,
);
$this->assertEquals(
" DEFAULT '".$currentDateSql."'",
$this->_platform->getDefaultValueDeclarationSQL($field)
);
}
}
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