Skip to content

Commit b895e52

Browse files
keulinhomorozov
authored andcommitted
Reproduce dots in quted names
1 parent cb14f20 commit b895e52

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
@@ -266,4 +266,61 @@ public function testIntrospectTableWithDotInName(): void
266266

267267
self::assertCount(1, $table->getColumns());
268268
}
269+
270+
public function testIntrospectTableWithDotInIndexNames(): void
271+
{
272+
$table = Table::editor()
273+
->setQuotedName('user')
274+
->setColumns(
275+
Column::editor()
276+
->setUnquotedName('id')
277+
->setTypeName(Types::INTEGER)
278+
->create(),
279+
)
280+
->create();
281+
282+
$this->dropAndCreateTable($table);
283+
284+
$tableTo = Table::editor()
285+
->setUnquotedName('example')
286+
->setColumns(
287+
Column::editor()
288+
->setUnquotedName('id')
289+
->setTypeName(Types::INTEGER)
290+
->create(),
291+
Column::editor()
292+
->setUnquotedName('user_id')
293+
->setTypeName(Types::INTEGER)
294+
->create(),
295+
)
296+
->setPrimaryKeyConstraint(
297+
PrimaryKeyConstraint::editor()
298+
->setUnquotedColumnNames('id')
299+
->setQuotedName('pk.example.id')
300+
->create(),
301+
)
302+
->setForeignKeyConstraints(
303+
ForeignKeyConstraint::editor()
304+
->setUnquotedReferencingColumnNames('user_id')
305+
->setReferencedTableName($foreignTableName)
306+
->setUnquotedReferencedColumnNames('id')
307+
->setQuotedName('fk.example.user_id')
308+
->create(),
309+
)
310+
->setIndexes(
311+
Index::editor()
312+
->setQuotedName('idx.example.id')
313+
->setUnquotedColumnNames('id', 'user_id')
314+
->create()
315+
)
316+
->create();
317+
$this->dropAndCreateTable($tableTo);
318+
319+
320+
$table = $this->schemaManager->introspectTable('example');
321+
self::assertCount(2, $table->getColumns());
322+
self::assertSame('pk.example.id', $table->getPrimaryKeyConstraint()->getObjectName()->toString());
323+
self::assertSame('fk.example.user_id', $table->getForeignKey('fk.example.user_id')->getName());
324+
self::assertSame('idx.example.id', $table->getIndex('idx.example.id')->getName());
325+
}
269326
}

0 commit comments

Comments
 (0)