Skip to content

Commit 9e2b613

Browse files
committed
Reproduce dots in quted names
1 parent 15e518f commit 9e2b613

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

tests/Functional/Schema/SchemaManagerTest.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,61 @@ public function testIntrospectTableWithInvalidName(): void
275275

276276
$this->schemaManager->introspectTable('"example');
277277
}
278+
279+
public function testIntrospectTableWithDotInIndexNames(): void
280+
{
281+
$table = Table::editor()
282+
->setQuotedName('user')
283+
->setColumns(
284+
Column::editor()
285+
->setUnquotedName('id')
286+
->setTypeName(Types::INTEGER)
287+
->create(),
288+
)
289+
->create();
290+
291+
$this->dropAndCreateTable($table);
292+
293+
$tableTo = Table::editor()
294+
->setUnquotedName('example')
295+
->setColumns(
296+
Column::editor()
297+
->setUnquotedName('id')
298+
->setTypeName(Types::INTEGER)
299+
->create(),
300+
Column::editor()
301+
->setUnquotedName('user_id')
302+
->setTypeName(Types::INTEGER)
303+
->create(),
304+
)
305+
->setPrimaryKeyConstraint(
306+
PrimaryKeyConstraint::editor()
307+
->setUnquotedColumnNames('id')
308+
->setQuotedName('pk.example.id')
309+
->create(),
310+
)
311+
->setForeignKeyConstraints(
312+
ForeignKeyConstraint::editor()
313+
->setUnquotedReferencingColumnNames('user_id')
314+
->setReferencedTableName($foreignTableName)
315+
->setUnquotedReferencedColumnNames('id')
316+
->setQuotedName('fk.example.user_id')
317+
->create(),
318+
)
319+
->setIndexes([
320+
Index::editor()
321+
->setQuotedName('idx.example.id')
322+
->setUnquotedColumnNames('id', 'user_id')
323+
->create()
324+
])
325+
->create();
326+
$this->dropAndCreateTable($tableTo);
327+
328+
329+
$table = $this->schemaManager->introspectTable('example');
330+
self::assertCount(2, $table->getColumns());
331+
self::assertSame('pk.example.id', $table->getPrimaryKeyConstraint()->getObjectName()->toString());
332+
self::assertSame('fk.example.user_id', $table->getForeignKey('fk.example.user_id')->getName());
333+
self::assertSame('idx.example.id', $table->getIndex('idx.example.id')->getName());
334+
}
278335
}

0 commit comments

Comments
 (0)