packages/sql-semantics-postgres/tests/Unit/Statement/Object/Attribute/Choice/ChoiceTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Object\Attribute\Choice;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\Alignment;
11use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\Choice;
12use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\CollationProvider;
13use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\FinalModification;
14use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\Parallelism;
15use SqlSemantics\Platform\PostgreSql\Statement\Object\Attribute\Choice\StorageStrategy;
16
17#[CoversClass(Choice::class)]
18#[Small]
19final class ChoiceTest extends TestCase
20{
21 public function testReadAnswersTheMemberOrNull(): void
22 {
23 self::assertSame([Alignment::Int, null], [Alignment::read('INT4'), StorageStrategy::read('int4')]);
24 }
25
26 public function testEveryWordSetIsAChoice(): void
27 {
28 self::assertContains(Choice::class, class_implements(Alignment::class));
29 self::assertContains(Choice::class, class_implements(CollationProvider::class));
30 self::assertContains(Choice::class, class_implements(FinalModification::class));
31 self::assertContains(Choice::class, class_implements(Parallelism::class));
32 self::assertContains(Choice::class, class_implements(StorageStrategy::class));
33 }
34}
35