packages/sql-semantics-postgres/tests/Unit/Statement/Object/Attribute/Known/ParserAttributeTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Object\Attribute\Known;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Known\ParserAttribute;
11use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Reading;
12
13#[CoversClass(ParserAttribute::class)]
14#[Small]
15final class ParserAttributeTest extends TestCase
16{
17 public function testReadingFollowsTheCommand(): void
18 {
19 self::assertSame([Reading::Function, Reading::Function, Reading::Function, Reading::Function, Reading::Function], array_map(static fn (ParserAttribute $attribute): Reading => $attribute->reading(), ParserAttribute::cases()));
20 }
21
22 public function testNamedComparesRespectingCase(): void
23 {
24 self::assertSame([ParserAttribute::Start, null], [ParserAttribute::named('start'), ParserAttribute::named('START')]);
25 }
26
27 public function testTextIsTheAttributeName(): void
28 {
29 self::assertSame('start', ParserAttribute::Start->text());
30 }
31}
32