Skip to content

Commit fa25d4b

Browse files
committed
test: add test
1 parent 685e46a commit fa25d4b

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

tests/Tests/ORM/Tools/SchemaToolTest.php

+36
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,42 @@ public function testLoadUniqueConstraintWithoutName(): void
391391
self::assertTrue($tableIndex->isUnique());
392392
self::assertSame(['field', 'anotherField'], $tableIndex->getColumns());
393393
}
394+
395+
public function testJoinColumnWithOptions(): void
396+
{
397+
$em = $this->getTestEntityManager();
398+
$schemaTool = new SchemaTool($em);
399+
400+
$classes = [
401+
$em->getClassMetadata(TestEntityWithJoinColumnWithOptions::class),
402+
$em->getClassMetadata(TestEntityWithJoinColumnWithOptionsRelation::class),
403+
];
404+
405+
$schema = $schemaTool->getSchemaFromMetadata($classes);
406+
407+
self::assertSame(['deferrable' => true, 'deferred' => true], $schema->getTable('test')->getForeignKey('FK_D87F7E0CD87F7E0C')->getOptions());
408+
}
409+
}
410+
411+
#[Table('test')]
412+
#[Entity]
413+
class TestEntityWithJoinColumnWithOptions
414+
{
415+
#[Id]
416+
#[Column]
417+
private int $id;
418+
419+
#[OneToOne(targetEntity: TestEntityWithJoinColumnWithOptionsRelation::class)]
420+
#[JoinColumn(name: 'test', referencedColumnName: 'id', options: ['deferrable' => true, 'deferred' => true])]
421+
private TestEntityWithJoinColumnWithOptionsRelation $test;
422+
}
423+
424+
#[Entity]
425+
class TestEntityWithJoinColumnWithOptionsRelation
426+
{
427+
#[Id]
428+
#[Column]
429+
private int $id;
394430
}
395431

396432
#[Table(options: ['foo' => 'bar', 'baz' => ['key' => 'val']])]

0 commit comments

Comments
 (0)