Skip to content

Commit

Permalink
Fix SchemaManagerFunctionalTestCase::testSwitchPrimaryKeyOrder()
Browse files Browse the repository at this point in the history
  • Loading branch information
morozov committed Mar 4, 2025
1 parent 98cf3a2 commit 4093dd9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/Functional/Schema/SchemaManagerFunctionalTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1462,8 +1462,21 @@ public function testChangeIndexWithForeignKeys(): void
self::assertTrue($child->hasIndex('idx_2'));
}

/** @throws Exception */
public function testSwitchPrimaryKeyOrder(): void
{
$platform = $this->connection->getDatabasePlatform();

if (
$platform instanceof DB2Platform
|| $platform instanceof OraclePlatform
|| $platform instanceof SQLServerPlatform
) {
self::markTestIncomplete(
'Dropping primary key constraint on the currently used database platform is not implemented.',
);
}

$prototype = new Table('test_switch_pk_order');
$prototype->addColumn('foo_id', Types::INTEGER);
$prototype->addColumn('bar_id', Types::INTEGER);
Expand All @@ -1481,11 +1494,13 @@ public function testSwitchPrimaryKeyOrder(): void
$schemaManager->introspectTable('test_switch_pk_order'),
$table,
);
self::assertFalse($diff->isEmpty());
$schemaManager->alterTable($diff);

$table = $schemaManager->introspectTable('test_switch_pk_order');
$primaryKey = $table->getPrimaryKey();
self::assertNotNull($primaryKey);
self::assertSame(['foo_id', 'bar_id'], array_map('strtolower', $primaryKey->getColumns()));
self::assertSame(['bar_id', 'foo_id'], array_map('strtolower', $primaryKey->getColumns()));
}

public function testDropColumnWithDefault(): void
Expand Down

0 comments on commit 4093dd9

Please # to comment.