packages/sql-semantics-postgres/tests/Unit/Statement/Relation/JoinKindTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Relation;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10
11#[CoversClass(\SqlSemantics\Platform\PostgreSql\Statement\Relation\JoinKind::class)]
12#[Small]
13final class JoinKindTest extends TestCase
14{
15    public function testExtendsRightForLeftAndFullJoins(): void
16    {
17        self::assertSame([false, false, true, false, true], array_map(static fn (\SqlSemantics\Platform\PostgreSql\Statement\Relation\JoinKind $kind): bool => $kind->extendsRight(), \SqlSemantics\Platform\PostgreSql\Statement\Relation\JoinKind::cases()));
18    }
19
20    public function testExtendsLeftForRightAndFullJoins(): void
21    {
22        self::assertSame([false, false, false, true, true], array_map(static fn (\SqlSemantics\Platform\PostgreSql\Statement\Relation\JoinKind $kind): bool => $kind->extendsLeft(), \SqlSemantics\Platform\PostgreSql\Statement\Relation\JoinKind::cases()));
23    }
24
25    public function testKeywordsLeaveInnerUnwritten(): void
26    {
27        self::assertSame([[], ['CROSS']], [\SqlSemantics\Platform\PostgreSql\Statement\Relation\JoinKind::Inner->keywords(), \SqlSemantics\Platform\PostgreSql\Statement\Relation\JoinKind::Cross->keywords()]);
28    }
29}
30