packages/sql-catalog/tests/Unit/Platform/PostgreSql/DialectTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Platform\PostgreSql;
6
7use PHPUnit\Framework\TestCase;
8
9#[\PHPUnit\Framework\Attributes\CoversClass(\SqlCatalog\Platform\PostgreSql\Dialect::class)]
10final class DialectTest extends TestCase
11{
12 public function testIdentifierQuoteMatchesTheLanguage(): void
13 {
14 self::assertSame('"', (new \SqlCatalog\Platform\PostgreSql\Dialect())->identifierQuote());
15 }
16
17 public function testInsertPrefixPreservesConflictHandling(): void
18 {
19 self::assertSame('insert into ', (new \SqlCatalog\Platform\PostgreSql\Dialect())->insertPrefix(false));
20 self::assertSame('insert into ', (new \SqlCatalog\Platform\PostgreSql\Dialect())->insertPrefix(true));
21 }
22
23 public function testInsertSuffixPreservesConflictHandling(): void
24 {
25 self::assertSame('', (new \SqlCatalog\Platform\PostgreSql\Dialect())->insertSuffix(false));
26 self::assertSame(' on conflict do nothing', (new \SqlCatalog\Platform\PostgreSql\Dialect())->insertSuffix(true));
27 }
28
29 public function testReturningSuffixNamesHowTheGeneratedKeyIsRead(): void
30 {
31 self::assertSame(' returning ', (new \SqlCatalog\Platform\PostgreSql\Dialect())->returningSuffix());
32 }
33}
34