packages/sql-semantics-mysql/tests/Unit/Statement/Dml/Load/LineOptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Dml\Load;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Model\Rendering\Lexical;
11use SqlSemantics\Platform\MySql\Model\Rendering\Output;
12use SqlSemantics\Platform\MySql\Rendering\Codec;
13use SqlSemantics\Platform\MySql\Semantics;
14use SqlSemantics\Platform\MySql\Statement\Dml\Load\LineOption;
15use SqlSemantics\Platform\MySql\Statement\Dml\Load\LineOptionKind;
16use SqlSemantics\Platform\MySql\Statement\Literal\Text;
17
18#[CoversClass(LineOption::class)]
19#[Medium]
20final class LineOptionTest extends TestCase
21{
22 public function testRenderWritesTheOption(): void
23 {
24 $out = new Output(new Codec((new Semantics())->profile()->grammar));
25 (new LineOption(LineOptionKind::Starting, new Text('x')))->render($out);
26
27 self::assertSame("STARTING BY 'x'", (new Lexical())->join($out->pieces()));
28 }
29}
30