8000 Test default value declaration for the date type by greg0ire · Pull Request #2851 · doctrine/dbal · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Test default value declaration for the date type #2851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,20 @@ public function testGetDefaultValueDeclarationSQLForIntegerTypes()
}
}

public function testGetDefaultValueDeclarationSQLForDateType()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testGetDefaultValueDeclarationSQLForDateType() : void

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is applicable on the other files as well...

{
$currentDateSql = $this->_platform->getCurrentDateSQL();
$field = array(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use short-array syntax

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is applicable on the other files as well...

'type' => Type::getType('date'),
'default' => $currentDateSql,
);

$this->assertEquals(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be self::assertSame()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is applicable on the other files as well...

' DEFAULT '.$currentDateSql,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing spaces

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is applicable on the other files as well...

$this->_platform->getDefaultValueDeclarationSQL($field)
);
}

/**
* @group DBAL-45
*/
Expand Down
15 changes: 15 additions & 0 deletions tests/Doctrine/Tests/DBAL/Platforms/SQLServer2008PlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms;

use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Types\Type;

class SQLServer2008PlatformTest extends AbstractSQLServerPlatformTestCase
{
Expand All @@ -19,4 +20,18 @@ public function testGeneratesTypeDeclarationForDateTimeTz()
array())
);
}

public function testGetDefaultValueDeclarationSQLForDateType()
{
$currentDateSql = $this->_platform->getCurrentDateSQL();
$field = array(
'type' => Type::getType('date'),
'default' => $currentDateSql,
);

$this->assertEquals(
" DEFAULT '".$currentDateSql."'",
$this->_platform->getDefaultValueDeclarationSQL($field)
);
}
}
15 changes: 15 additions & 0 deletions tests/Doctrine/Tests/DBAL/Platforms/SQLServer2012PlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Types DDA9 \Type;

class SQLServer2012PlatformTest extends AbstractSQLServerPlatformTestCase
{
Expand Down Expand Up @@ -371,4 +372,18 @@ public function testModifyLimitQueryWithNewlineBeforeOrderBy()
$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)
);
}
}
14 changes: 14 additions & 0 deletions tests/Doctrine/Tests/DBAL/Platforms/SQLServerPlatformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Types\Type;

class SQLServerPlatformTest extends AbstractSQLServerPlatformTestCase
{
Expand Down Expand Up @@ -58,4 +59,17 @@ public function getModifyLimitQueries()
);
}

public function testGetDefaultValueDeclarationSQLForDateType()
{
$currentDateSql = $this->_platform->getCurrentDateSQL();
$field = array(
'type' => Type::getType('date'),
'default' => $currentDateSql,
);

$this->assertEquals(
" DEFAULT '".$currentDateSql."'",
$this->_platform->getDefaultValueDeclarationSQL($field)
);
}
}
0