Skip to content

Commit be9c119

Browse files
authored
Merge pull request #6819 from morozov/fix-test-switch-primary-key-order
Fix SchemaManagerFunctionalTestCase::testSwitchPrimaryKeyOrder()
2 parents 98cf3a2 + 4093dd9 commit be9c119

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/Functional/Schema/SchemaManagerFunctionalTestCase.php

+16-1
Original file line numberDiff line numberDiff line change
@@ -1462,8 +1462,21 @@ public function testChangeIndexWithForeignKeys(): void
14621462
self::assertTrue($child->hasIndex('idx_2'));
14631463
}
14641464

1465+
/** @throws Exception */
14651466
public function testSwitchPrimaryKeyOrder(): void
14661467
{
1468+
$platform = $this->connection->getDatabasePlatform();
1469+
1470+
if (
1471+
$platform instanceof DB2Platform
1472+
|| $platform instanceof OraclePlatform
1473+
|| $platform instanceof SQLServerPlatform
1474+
) {
1475+
self::markTestIncomplete(
1476+
'Dropping primary key constraint on the currently used database platform is not implemented.',
1477+
);
1478+
}
1479+
14671480
$prototype = new Table('test_switch_pk_order');
14681481
$prototype->addColumn('foo_id', Types::INTEGER);
14691482
$prototype->addColumn('bar_id', Types::INTEGER);
@@ -1481,11 +1494,13 @@ public function testSwitchPrimaryKeyOrder(): void
14811494
$schemaManager->introspectTable('test_switch_pk_order'),
14821495
$table,
14831496
);
1497+
self::assertFalse($diff->isEmpty());
1498+
$schemaManager->alterTable($diff);
14841499

14851500
$table = $schemaManager->introspectTable('test_switch_pk_order');
14861501
$primaryKey = $table->getPrimaryKey();
14871502
self::assertNotNull($primaryKey);
1488-
self::assertSame(['foo_id', 'bar_id'], array_map('strtolower', $primaryKey->getColumns()));
1503+
self::assertSame(['bar_id', 'foo_id'], array_map('strtolower', $primaryKey->getColumns()));
14891504
}
14901505

14911506
public function testDropColumnWithDefault(): void

0 commit comments

Comments
 (0)