packages/sql-semantics-postgres/tests/Unit/Statement/Option/GenericOptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Option;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Model\Contract\GrammarRelease;
11use SqlSemantics\Platform\PostgreSql\Model\Rendering\Lexical;
12use SqlSemantics\Platform\PostgreSql\Model\Rendering\Output;
13use SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name;
14use SqlSemantics\Platform\PostgreSql\Rendering\Codec;
15use SqlSemantics\Platform\PostgreSql\Statement\Literal\StringConstant;
16use SqlSemantics\Platform\PostgreSql\Statement\Option\GenericOption;
17
18#[CoversClass(GenericOption::class)]
19#[Small]
20final class GenericOptionTest extends TestCase
21{
22 public function testRenderWritesTheNameAndTheValue(): void
23 {
24 $out = new Output(new Codec(GrammarRelease::PostgreSql172));
25 (new GenericOption(new Name('Host'), new StringConstant('db1')))->render($out);
26 self::assertSame('"Host" \'db1\'', (new Lexical())->join($out->pieces()));
27 }
28}
29