packages/sql-semantics-postgres/tests/Unit/Statement/Utility/LoadTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Utility;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Semantics;
11use SqlSemantics\Platform\PostgreSql\Statement\Utility\Load;
12
13#[CoversClass(Load::class)]
14#[Medium]
15final class LoadTest extends TestCase
16{
17 public function testDeriveStatementRecordsNothing(): void
18 {
19 $operation = (new Semantics())->analyze("LOAD 'x'");
20 self::assertSame([[], null], [$operation->facts->diagnostics, $operation->facts->output]);
21 }
22
23 public function testRenderWritesTheFileString(): void
24 {
25 self::assertSame("LOAD '\$libdir/plugins/a''b'", (new Semantics())->analyze("LOAD E'\$libdir/plugins/a\\'b'")->toString());
26 }
27}
28