forked from doctrine/dbal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented comparison of default values as strings regardless of the…
…ir PHP types Fixes doctrine#3336.
- Loading branch information
Showing
2 changed files
with
46 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
tests/Doctrine/Tests/DBAL/Functional/Schema/ComparatorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Tests\DBAL\Functional\Schema; | ||
|
||
use Doctrine\DBAL\Schema\AbstractSchemaManager; | ||
use Doctrine\DBAL\Schema\Comparator; | ||
use Doctrine\DBAL\Schema\Table; | ||
use Doctrine\Tests\DbalFunctionalTestCase; | ||
|
||
class ComparatorTest extends DbalFunctionalTestCase | ||
{ | ||
/** @var AbstractSchemaManager */ | ||
private $schemaManager; | ||
|
||
/** @var Comparator */ | ||
private $comparator; | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->schemaManager = $this->connection->getSchemaManager(); | ||
$this->comparator = new Comparator(); | ||
} | ||
|
||
public function testDefaultValueComparison() | ||
{ | ||
$table = new Table('default_value'); | ||
$table->addColumn('id', 'integer', ['default' => 1]); | ||
|
||
$this->schemaManager->createTable($table); | ||
|
||
$onlineTable = $this->schemaManager->listTableDetails('default_value'); | ||
|
||
self::assertFalse($this->comparator->diffTable($table, $onlineTable)); | ||
} | ||
} |