diff --git a/tests/Functional/Schema/SQLiteSchemaManagerTest.php b/tests/Functional/Schema/SQLiteSchemaManagerTest.php index 3ba44f8f04..397394480c 100644 --- a/tests/Functional/Schema/SQLiteSchemaManagerTest.php +++ b/tests/Functional/Schema/SQLiteSchemaManagerTest.php @@ -214,7 +214,7 @@ public function testNonSimpleAlterTableCreatedFromDDL(): void $table1 = $schemaManager->introspectTable('nodes'); $table2 = clone $table1; - $table2->addIndex(['name'], 'idx_name'); + $table2->addIndex(['name'], 'idx_node_name'); $comparator = $schemaManager->createComparator(); $diff = $comparator->compareTables($table1, $table2); @@ -222,7 +222,7 @@ public function testNonSimpleAlterTableCreatedFromDDL(): void $schemaManager->alterTable($diff); $table = $schemaManager->introspectTable('nodes'); - $index = $table->getIndex('idx_name'); + $index = $table->getIndex('idx_node_name'); self::assertSame(['name'], $index->getColumns()); } diff --git a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php index 684e3ee20e..d34d1c17d1 100644 --- a/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php +++ b/tests/Functional/Schema/SchemaManagerFunctionalTestCase.php @@ -9,7 +9,6 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Platforms\OraclePlatform; -use Doctrine\DBAL\Platforms\PostgreSQLPlatform; use Doctrine\DBAL\Platforms\SQLitePlatform; use Doctrine\DBAL\Schema\AbstractAsset; use Doctrine\DBAL\Schema\AbstractSchemaManager; @@ -1269,14 +1268,10 @@ public function testQuotedIdentifiers(): void ); } - if (! $platform instanceof OraclePlatform && ! $platform instanceof PostgreSQLPlatform) { - self::markTestSkipped('The current platform does not auto-quote introspected identifiers.'); - } - $artists = new Table('"Artists"'); $artists->addColumn('"Id"', Types::INTEGER); $artists->addColumn('"Name"', Types::INTEGER); - $artists->addIndex(['"Name"'], '"Idx_Name"'); + $artists->addIndex(['"Name"'], '"Idx_Artist_Name"'); $artists->setPrimaryKey(['"Id"']); $tracks = new Table('"Tracks"'); @@ -1292,8 +1287,8 @@ public function testQuotedIdentifiers(): void ); $tracks->setPrimaryKey(['"Id"']); - $this->dropTableIfExists('"Tracks"'); - $this->dropTableIfExists('"Artists"'); + $this->dropTableIfExists($tracks->getObjectName()->toSQL($platform)); + $this->dropTableIfExists($artists->getObjectName()->toSQL($platform)); $this->schemaManager->createTable($artists); $this->schemaManager->createTable($tracks); @@ -1301,8 +1296,6 @@ public function testQuotedIdentifiers(): void $artists = $this->schemaManager->introspectTable('"Artists"'); $tracks = $this->schemaManager->introspectTable('"Tracks"'); - $platform = $this->connection->getDatabasePlatform(); - // Primary table assertions self::assertOptionallyQualifiedNameEquals( OptionallyQualifiedName::quoted('Artists'), @@ -1319,11 +1312,15 @@ public function testQuotedIdentifiers(): void $artists->getColumn('"Name"')->getObjectName(), ); - self::assertSame(['"Name"'], $artists->getIndex('"Idx_Name"')->getQuotedColumns($platform)); + self::assertSame([ + $platform->quoteSingleIdentifier('Name'), + ], $artists->getIndex('"Idx_Artist_Name"')->getQuotedColumns($platform)); $primaryKey = $artists->getPrimaryKey(); self::assertNotNull($primaryKey); - self::assertSame(['"Id"'], $primaryKey->getQuotedColumns($platform)); + self::assertSame([ + $platform->quoteSingleIdentifier('Id'), + ], $primaryKey->getQuotedColumns($platform)); // Foreign table assertions self::assertUnqualifiedNameEquals( @@ -1333,7 +1330,9 @@ public function testQuotedIdentifiers(): void $primaryKey = $tracks->getPrimaryKey(); self::assertNotNull($primaryKey); - self::assertSame(['"Id"'], $primaryKey->getQuotedColumns($platform)); + self::assertSame([ + $platform->quoteSingleIdentifier('Id'), + ], $primaryKey->getQuotedColumns($platform)); self::assertUnqualifiedNameEquals( UnqualifiedName::quoted('Artist_Id'), @@ -1341,10 +1340,9 @@ public function testQuotedIdentifiers(): void ); self::assertTrue($tracks->hasIndex('"Idx_Artist_Id"')); - self::assertSame( - ['"Artist_Id"'], - $tracks->getIndex('"Idx_Artist_Id"')->getQuotedColumns($platform), - ); + self::assertSame([ + $platform->quoteSingleIdentifier('Artist_Id'), + ], $tracks->getIndex('"Idx_Artist_Id"')->getQuotedColumns($platform)); $constraint = $tracks->getForeignKey('"Artists_Fk"');