packages/sql-semantics-postgres/tests/Unit/Statement/Catalog/Problem/CatalogMisuseRuleTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Catalog\Problem;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10
11#[CoversClass(\SqlSemantics\Platform\PostgreSql\Statement\Catalog\Problem\CatalogMisuseRule::class)]
12#[Medium]
13final class CatalogMisuseRuleTest extends TestCase
14{
15 public function testRuleOfARejectedEnumDrop(): void
16 {
17 $problem = (new \SqlSemantics\Platform\PostgreSql\Semantics())->inspect("ALTER TYPE t DROP VALUE 'a'")->facts->diagnostics[0];
18 self::assertInstanceOf(\SqlSemantics\Platform\PostgreSql\Statement\Catalog\Problem\CatalogMisuse::class, $problem);
19 self::assertSame(\SqlSemantics\Platform\PostgreSql\Statement\Catalog\Problem\CatalogMisuseRule::EnumValueDrop, $problem->rule);
20 }
21}
22