packages/sql-semantics-mysql/tests/Unit/Statement/Call/Weight/WeightLevelRangeTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Call\Weight;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Model\Contract\ParameterStyle;
11use SqlSemantics\Platform\MySql\Model\Rendering\Lexical;
12use SqlSemantics\Platform\MySql\Model\Rendering\Output;
13use SqlSemantics\Platform\MySql\Platform;
14use SqlSemantics\Platform\MySql\Statement\Call\Weight\WeightLevelRange;
15use SqlSemantics\Platform\MySql\Statement\Literal\Numeral;
16
17#[CoversClass(WeightLevelRange::class)]
18#[Small]
19final class WeightLevelRangeTest extends TestCase
20{
21 public function testRenderWritesTheRange(): void
22 {
23 $platform = new Platform();
24 $profile = $platform->profile('mysql-8.4.7', null, ParameterStyle::Native);
25 $out = new Output($platform->codec($profile));
26 (new WeightLevelRange(new Numeral('1'), new Numeral('3')))->render($out);
27
28 self::assertSame('1 - 3', (new Lexical())->join($out->pieces()));
29 }
30}
31