packages/sql-semantics-sqlite/tests/Unit/Model/Resolution/ImplicitSlotTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Model\Resolution;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\Sqlite\Model\Resolution\ImplicitSlot;
11use SqlSemantics\Platform\Sqlite\Model\Statement\Identifier\Name;
12use SqlSemantics\Platform\Sqlite\Model\Statement\Shape\OutputSlot;
13use SqlSemantics\Platform\Sqlite\Model\Statement\Type\Known;
14use SqlSemantics\Platform\Sqlite\Model\Statement\Type\Nullability;
15use SqlSemantics\Platform\Sqlite\Statement\Type\Storage;
16
17#[CoversClass(ImplicitSlot::class)]
18#[Small]
19final class ImplicitSlotTest extends TestCase
20{
21 public function testEveryNameLeadsToTheOneSlot(): void
22 {
23 $slot = new OutputSlot(new Name('rowid'), new Known(Storage::Integer), Nullability::NotNull);
24
25 $implicit = new ImplicitSlot([new Name('rowid'), new Name('oid')], $slot);
26
27 self::assertSame(['rowid', 'oid'], array_map(static fn (Name $name): string => $name->value, $implicit->names));
28 self::assertSame($slot, $implicit->slot);
29 }
30}
31