packages/sql-semantics-sqlite/tests/Unit/Model/Diagnostic/InvalidConstructionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Model\Diagnostic;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\Sqlite\Model\Diagnostic\InvalidConstruction;
11use SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name;
12use SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\QualifiedName;
13
14#[CoversClass(InvalidConstruction::class)]
15#[Small]
16final class InvalidConstructionTest extends TestCase
17{
18 public function testAConstructorReportsAnInputOutsideItsDomain(): void
19 {
20 $this->expectExceptionMessage('A catalog qualifier requires a schema qualifier.');
21
22 new QualifiedName(new Name('t'), null, new Name('c'));
23 }
24
25 public function testTheMessageIsKept(): void
26 {
27 self::assertSame('A node occurs twice.', (new InvalidConstruction('A node occurs twice.'))->getMessage());
28 }
29}
30