packages/sql-semantics-mysql/tests/Unit/Statement/Dml/Handler/HandlerScanTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Dml\Handler;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Semantics;
11use SqlSemantics\Platform\MySql\Statement\Dml\Handler\HandlerScan;
12
13#[CoversClass(HandlerScan::class)]
14#[Medium]
15final class HandlerScanTest extends TestCase
16{
17 public function testDeriveStatementRecordsOpenRows(): void
18 {
19 $operation = (new Semantics())->analyze('HANDLER h READ NEXT LIMIT 2');
20
21 self::assertNotNull($operation->facts->output);
22 self::assertFalse($operation->facts->output->shape->complete());
23 }
24
25 public function testRenderWritesTheRead(): void
26 {
27 self::assertSame('HANDLER h READ NEXT WHERE a > 1 LIMIT 1', (new Semantics('mysql-5.6.51'))->analyze('handler h read next where a > 1 limit 1')->toString());
28 }
29}
30