packages/sql-semantics-postgres/tests/Unit/Statement/Object/CopyCollationTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Object;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Semantics;
11use SqlSemantics\Platform\PostgreSql\Statement\Object\CopyCollation;
12
13#[CoversClass(CopyCollation::class)]
14#[Medium]
15final class CopyCollationTest extends TestCase
16{
17    public function testDeriveStatementRecordsNothing(): void
18    {
19        $operation = (new Semantics())->analyze('CREATE COLLATION c FROM d', []);
20        self::assertSame([], $operation->facts->diagnostics);
21    }
22
23    public function testRenderWritesIfNotExists(): void
24    {
25        $operation = (new Semantics())->analyze('CREATE COLLATION IF NOT EXISTS s.c FROM "C"');
26        self::assertSame('CREATE COLLATION IF NOT EXISTS s.c FROM "C"', $operation->toString());
27    }
28}
29