packages/sql-semantics-mysql/tests/Unit/Statement/Dml/Insert/InsertedRowTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Dml\Insert;
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\DefaultRequest;
15use SqlSemantics\Platform\MySql\Statement\Dml\Insert\InsertedRow;
16use SqlSemantics\Platform\MySql\Statement\Literal\NumberLiteral;
17
18#[CoversClass(InsertedRow::class)]
19#[Medium]
20final class InsertedRowTest extends TestCase
21{
22    public function testRenderWritesTheParenthesizedValues(): void
23    {
24        $out = new Output(new Codec((new Semantics())->profile()->grammar));
25        (new InsertedRow([new NumberLiteral('1'), new DefaultRequest()]))->render($out);
26
27        self::assertSame('(1, DEFAULT)', (new Lexical())->join($out->pieces()));
28    }
29}
30