packages/sql-semantics-postgres/tests/Unit/Statement/Manipulation/Cursor/CloseTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Manipulation\Cursor;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10
11#[CoversClass(\SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Cursor\Close::class)]
12#[Medium]
13final class CloseTest extends TestCase
14{
15 public function testDeriveStatementDerivesNothing(): void
16 {
17 $semantics = new \SqlSemantics\Platform\PostgreSql\Semantics('pg-17.2');
18 $query = $semantics->analyze('CLOSE ALL');
19 $statement = $query->statement;
20 self::assertInstanceOf(\SqlSemantics\Platform\PostgreSql\Statement\Manipulation\Cursor\Close::class, $statement);
21 self::assertSame([null, null], [$query->facts->output, $statement->cursor]);
22 }
23
24 public function testRenderWritesTheCursor(): void
25 {
26 $semantics = new \SqlSemantics\Platform\PostgreSql\Semantics('pg-17.2');
27 $query = $semantics->analyze('CLOSE c');
28 self::assertSame('CLOSE c', $query->toString());
29 }
30}
31