packages/sql-semantics-postgres/tests/Unit/Rules/Query/TargetNamesTest.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\TargetNames::class)]
12#[Small]
13final class TargetNamesTest extends TestCase
14{
15 public function testNameFallsBackToQuestionColumn(): void
16 {
17 self::assertSame('?column?', (new \SqlSemantics\Platform\PostgreSql\Rules\Query\TargetNames())->name(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\Constant(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\IntegerConstant('1')))->value);
18 }
19
20 public function testFirstIsNullForALeadingStar(): void
21 {
22 self::assertNull((new \SqlSemantics\Platform\PostgreSql\Rules\Query\TargetNames())->first([new \SqlSemantics\Platform\PostgreSql\Statement\Query\StarTarget()]));
23 }
24}
25