packages/sql-semantics-postgres/tests/Unit/Statement/Object/Attribute/Choice/AlignmentTest.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;
11
12#[CoversClass(Alignment::class)]
13#[Small]
14final class AlignmentTest extends TestCase
15{
16    public function testReadAcceptsTheTranslatedTypeNames(): void
17    {
18        self::assertSame([Alignment::Double, Alignment::Double, Alignment::Int, Alignment::Short, Alignment::Char], [Alignment::read('DOUBLE'), Alignment::read('pg_catalog.float8'), Alignment::read('pg_catalog.int4'), Alignment::read('int2'), Alignment::read('pg_catalog.bpchar')]);
19    }
20
21    public function testReadRejectsOtherWords(): void
22    {
23        self::assertNull(Alignment::read('int8'));
24    }
25}
26