packages/sql-semantics-postgres/tests/Unit/Statement/Object/Problem/AttributeProblemKindTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Object\Problem;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Statement\Object\Problem\AttributeProblemKind;
11
12#[CoversClass(AttributeProblemKind::class)]
13#[Small]
14final class AttributeProblemKindTest extends TestCase
15{
16    public function testFormatCarriesTheServerMessage(): void
17    {
18        self::assertSame(['type attribute "%s" not recognized', 'type attribute "%s" not recognized', 'argument of %s must be a name'], [AttributeProblemKind::UnrecognizedTypeAttribute->format(), AttributeProblemKind::UnrecognizedRangeAttribute->format(), AttributeProblemKind::NotAName->format()]);
19    }
20
21    public function testWarningHoldsForTheBackwardsCompatibleCommands(): void
22    {
23        self::assertSame([AttributeProblemKind::UnrecognizedOperatorAttribute, AttributeProblemKind::UnrecognizedAggregateAttribute, AttributeProblemKind::UnrecognizedTypeAttribute], array_values(array_filter(AttributeProblemKind::cases(), static fn (AttributeProblemKind $kind): bool => $kind->warning())));
24    }
25}
26