Skip to content

Commit e882b6d

Browse files
committed
test: add test for sql result
1 parent 2f0756c commit e882b6d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/Tests/ORM/Tools/SchemaToolTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Doctrine\Tests\ORM\Tools;
66

77
use Doctrine\Common\Collections\Collection;
8+
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
89
use Doctrine\ORM\Mapping\ClassMetadata;
910
use Doctrine\ORM\Mapping\Column;
1011
use Doctrine\ORM\Mapping\Entity;
@@ -44,6 +45,7 @@
4445

4546
use function count;
4647
use function current;
48+
use function end;
4749

4850
class SchemaToolTest extends OrmTestCase
4951
{
@@ -405,6 +407,10 @@ public function testJoinColumnWithOptions(): void
405407
$schema = $schemaTool->getSchemaFromMetadata($classes);
406408

407409
self::assertSame(['deferrable' => true, 'deferred' => true], $schema->getTable('test')->getForeignKey('FK_D87F7E0C1E5D0459')->getOptions());
410+
411+
$sql = $schema->toSql(new PostgreSQLPlatform());
412+
413+
$this->assertSame('ALTER TABLE test ADD CONSTRAINT FK_D87F7E0C1E5D0459 FOREIGN KEY (test_id) REFERENCES test_relation (id) DEFERRABLE INITIALLY DEFERRED', end($sql));
408414
}
409415
}
410416

@@ -421,6 +427,7 @@ class TestEntityWithJoinColumnWithOptions
421427
private TestEntityWithJoinColumnWithOptionsRelation $test;
422428
}
423429

430+
#[Table('test_relation')]
424431
#[Entity]
425432
class TestEntityWithJoinColumnWithOptionsRelation
426433
{

0 commit comments

Comments
 (0)