packages/sql-semantics-postgres/tests/Unit/Rules/Query/UnknownOutputsTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Rules\Query;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10
11#[CoversClass(\SqlSemantics\Platform\PostgreSql\Rules\Query\UnknownOutputs::class)]
12#[Small]
13final class UnknownOutputsTest extends TestCase
14{
15 public function testRawKeepsAnUntypedLiteralUnknown(): void
16 {
17 $field = new \SqlSemantics\Platform\PostgreSql\Model\Statement\Shape\Field(0, new \SqlSemantics\Platform\PostgreSql\Model\Statement\Shape\OutputSlot(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a'), new \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Known(\SqlSemantics\Platform\PostgreSql\Statement\Type\Descriptor\Builtin::Int4), \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Nullability::NotNull), new \SqlSemantics\Platform\PostgreSql\Statement\Expression\Grouped(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\NullLiteral()));
18 self::assertEquals(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Type\Known(\SqlSemantics\Platform\PostgreSql\Statement\Type\Descriptor\Builtin::Unknown), (new \SqlSemantics\Platform\PostgreSql\Rules\Query\UnknownOutputs())->raw($field));
19 }
20}
21