packages/sql-semantics-postgres/tests/Unit/Statement/Catalog/Cast/CastConversionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Catalog\Cast;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10
11#[CoversClass(\SqlSemantics\Platform\PostgreSql\Statement\Catalog\Cast\CastConversion::class)]
12#[Medium]
13final class CastConversionTest extends TestCase
14{
15 public function testRenderWritesInout(): void
16 {
17 $out = new \SqlSemantics\Platform\PostgreSql\Model\Rendering\Output(new \SqlSemantics\Platform\PostgreSql\Rendering\Codec(\SqlSemantics\Platform\PostgreSql\Model\Contract\GrammarRelease::PostgreSql172));
18 \SqlSemantics\Platform\PostgreSql\Statement\Catalog\Cast\CastConversion::InOut->render($out);
19 self::assertSame('WITH INOUT', (new \SqlSemantics\Platform\PostgreSql\Model\Rendering\Lexical())->join($out->pieces()));
20 }
21
22 public function testDeriveClauseRecordsNothing(): void
23 {
24 self::assertSame([], (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('CREATE CAST (a AS b) WITHOUT FUNCTION')->facts->diagnostics);
25 }
26}
27