packages/sql-semantics-sqlite/tests/Unit/Model/Statement/Reference/Missing/UndeclaredRelationTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Model\Statement\Reference\Missing;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name;
11use SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\QualifiedName;
12use SqlSemantics\Platform\Sqlite\Model\Statement\Reference\Missing\UndeclaredRelation;
13
14#[CoversClass(UndeclaredRelation::class)]
15#[Small]
16final class UndeclaredRelationTest extends TestCase
17{
18 public function testDescribeNamesAnUnqualifiedRelation(): void
19 {
20 self::assertSame('the declaration of relation t', (new UndeclaredRelation(new QualifiedName(new Name('t'))))->describe());
21 }
22
23 public function testDescribeWritesEveryQualifierTheStatementWrote(): void
24 {
25 $name = new QualifiedName(new Name('t'), new Name('s'), new Name('c'));
26
27 $missing = new UndeclaredRelation($name);
28
29 self::assertSame('the declaration of relation c.s.t', $missing->describe());
30 self::assertSame($name, $missing->name);
31 }
32}
33