packages/sql-semantics-postgres/tests/Unit/Statement/Invocation/Problem/JsonProblemTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Invocation\Problem;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Statement\Invocation\Problem\JsonProblem;
11use SqlSemantics\Platform\PostgreSql\Statement\Invocation\Problem\JsonProblemKind;
12
13#[CoversClass(JsonProblem::class)]
14#[Small]
15final class JsonProblemTest extends TestCase
16{
17 public function testMessageNamesTheSubjects(): void
18 {
19 self::assertSame('invalid ON EMPTY behavior for column "c"', (new JsonProblem(JsonProblemKind::InvalidColumnBehavior, ['ON EMPTY', 'c']))->message());
20 }
21
22 public function testRejectsAMissingSubject(): void
23 {
24 $this->expectExceptionMessage('A JSON problem names exactly the subjects its message has.');
25 new JsonProblem(JsonProblemKind::InvalidBehavior);
26 }
27}
28