packages/sql-semantics-postgres/tests/Unit/Statement/Table/View/CheckOptionTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Table\View;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10
11#[CoversClass(\SqlSemantics\Platform\PostgreSql\Statement\Table\View\CheckOption::class)]
12#[Medium]
13final class CheckOptionTest extends TestCase
14{
15    public function testCascadedIsFalseForLocal(): void
16    {
17        self::assertSame([
18          0 => true,
19          1 => true,
20          2 => false,
21        ], array_map(static fn ($option): bool => $option->cascaded(), \SqlSemantics\Platform\PostgreSql\Statement\Table\View\CheckOption::cases()));
22    }
23
24    public function testKeywordsSpellTheClause(): void
25    {
26        self::assertSame([
27          0 => 'WITH',
28          1 => 'CASCADED',
29          2 => 'CHECK',
30          3 => 'OPTION',
31        ], \SqlSemantics\Platform\PostgreSql\Statement\Table\View\CheckOption::Cascaded->keywords());
32    }
33}
34