packages/sql-semantics-postgres/tests/Unit/Lowering/Leaf/Keyword/ColumnNameKeywordsTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Lowering\Leaf\Keyword;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Lowering\Leaf\Keyword\ColumnNameKeywords;
11use SqlSemantics\Platform\PostgreSql\Model\Contract\GrammarRelease;
12use SqlSemantics\Platform\PostgreSql\Model\Contract\LanguageProfile;
13use SqlSemantics\Platform\PostgreSql\Platform;
14
15#[CoversClass(ColumnNameKeywords::class)]
16#[Small]
17final class ColumnNameKeywordsTest extends TestCase
18{
19 public function testSignaturesAreTheKeywordProductionsOfBothReleases(): void
20 {
21 $platform = new Platform();
22 $all = [...$platform->productions(new LanguageProfile(GrammarRelease::PostgreSql166))->all(), ...$platform->productions(new LanguageProfile(GrammarRelease::PostgreSql172))->all()];
23 $expected = array_values(array_unique(array_filter($all, static fn (string $signature): bool => str_starts_with($signature, 'col_name_keyword: '))));
24 sort($expected);
25 self::assertSame($expected, ColumnNameKeywords::SIGNATURES);
26 }
27}
28