From 6d85a14d3c53d3b88a1f91bfe6bb6029753b3f0c Mon Sep 17 00:00:00 2001 From: Sergei Morozov Date: Sun, 19 May 2019 12:07:09 -0700 Subject: [PATCH] Fixed some invalid tests discovered because of the changes from #2960 --- .../SchemaManagerFunctionalTestCase.php | 26 +++++-------------- .../AbstractSQLServerPlatformTestCase.php | 6 ++--- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php index ee166e9c7e5..f030ca30c8c 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -1054,12 +1054,9 @@ public function testColumnDefaultLifecycle() : void $table = new Table('col_def_lifecycle'); $table->addColumn('id', 'integer', ['autoincrement' => true]); $table->addColumn('column1', 'string', ['default' => null]); - $table->addColumn('column2', 'string', ['default' => false]); - $table->addColumn('column3', 'string', ['default' => true]); - $table->addColumn('column4', 'string', ['default' => 0]); - $table->addColumn('column5', 'string', ['default' => '']); - $table->addColumn('column6', 'string', ['default' => 'def']); - $table->addColumn('column7', 'integer', ['default' => 0]); + $table->addColumn('column2', 'string', ['default' => '']); + $table->addColumn('column3', 'string', ['default' => 'default1']); + $table->addColumn('column4', 'integer', ['default' => 0]); $table->setPrimaryKey(['id']); $this->schemaManager->dropAndCreateTable($table); @@ -1069,21 +1066,15 @@ public function testColumnDefaultLifecycle() : void self::assertNull($columns['id']->getDefault()); self::assertNull($columns['column1']->getDefault()); self::assertSame('', $columns['column2']->getDefault()); - self::assertSame('1', $columns['column3']->getDefault()); + self::assertSame('default1', $columns['column3']->getDefault()); self::assertSame('0', $columns['column4']->getDefault()); - self::assertSame('', $columns['column5']->getDefault()); - self::assertSame('def', $columns['column6']->getDefault()); - self::assertSame('0', $columns['column7']->getDefault()); $diffTable = clone $table; - $diffTable->changeColumn('column1', ['default' => false]); + $diffTable->changeColumn('column1', ['default' => '']); $diffTable->changeColumn('column2', ['default' => null]); - $diffTable->changeColumn('column3', ['default' => false]); + $diffTable->changeColumn('column3', ['default' => 'default2']); $diffTable->changeColumn('column4', ['default' => null]); - $diffTable->changeColumn('column5', ['default' => false]); - $diffTable->changeColumn('column6', ['default' => 666]); - $diffTable->changeColumn('column7', ['default' => null]); $comparator = new Comparator(); @@ -1093,11 +1084,8 @@ public function testColumnDefaultLifecycle() : void self::assertSame('', $columns['column1']->getDefault()); self::assertNull($columns['column2']->getDefault()); - self::assertSame('', $columns['column3']->getDefault()); + self::assertSame('default2', $columns['column3']->getDefault()); self::assertNull($columns['column4']->getDefault()); - self::assertSame('', $columns['column5']->getDefault()); - self::assertSame('666', $columns['column6']->getDefault()); - self::assertNull($columns['column7']->getDefault()); } public function testListTableWithBinary() : void diff --git a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php index 916958b9ee2..3e0fe761005 100644 --- a/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php +++ b/tests/Doctrine/Tests/DBAL/Platforms/AbstractSQLServerPlatformTestCase.php @@ -1032,9 +1032,9 @@ public function testChangeColumnsTypeWithDefaultValue() : void $tableDiff->changedColumns['col_string'] = new ColumnDiff( 'col_string', - new Column('col_string', Type::getType('string'), ['default' => 666, 'fixed' => true]), + new Column('col_string', Type::getType('string'), ['default' => 'bar', 'fixed' => true]), ['fixed'], - new Column('col_string', Type::getType('string'), ['default' => 666]) + new Column('col_string', Type::getType('string'), ['default' => 'foo']) ); $expected = $this->platform->getAlterTableSQL($tableDiff); @@ -1047,7 +1047,7 @@ public function testChangeColumnsTypeWithDefaultValue() : void 'ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_FA2CB292 DEFAULT 666 FOR col_int', 'ALTER TABLE column_def_change_type DROP CONSTRAINT DF_829302E0_2725A6D0', 'ALTER TABLE column_def_change_type ALTER COLUMN col_string NCHAR(255) NOT NULL', - "ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_2725A6D0 DEFAULT '666' FOR col_string", + "ALTER TABLE column_def_change_type ADD CONSTRAINT DF_829302E0_2725A6D0 DEFAULT 'bar' FOR col_string", ] ); }