packages/sql-semantics-mysql/tests/Unit/Statement/Alter/Column/ColumnVisibilityTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Alter\Column;
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\Alter\Column\ColumnVisibility;
12
13#[CoversClass(ColumnVisibility::class)]
14#[Medium]
15final class ColumnVisibilityTest extends TestCase
16{
17 public function testDeriveCommandDerivesNothing(): void
18 {
19 $semantics = new Semantics();
20 $table = $semantics->analyze('CREATE TABLE t (a INT, b INT)');
21 $alter = $semantics->analyze('ALTER TABLE t ALTER a SET VISIBLE', [$table]);
22
23 self::assertSame([], $alter->facts->diagnostics);
24 }
25
26 public function testRenderWritesTheVisibility(): void
27 {
28 self::assertSame('ALTER TABLE t ALTER COLUMN a SET VISIBLE', (new Semantics())->analyze('ALTER TABLE t ALTER a SET VISIBLE')->toString());
29 }
30}
31