packages/sql-semantics-mysql/tests/Unit/Statement/Call/JsonTableColumnTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Call;
6
7use PHPUnit\Framework\Attributes\CoversNothing;
8use PHPUnit\Framework\Attributes\Small;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Model\Construction\Derivation;
11use SqlSemantics\Platform\MySql\Model\Contract\ParameterStyle;
12use SqlSemantics\Platform\MySql\Model\Statement\Identifier\Name;
13use SqlSemantics\Platform\MySql\Platform;
14use SqlSemantics\Platform\MySql\Statement\Call\Json\OrdinalityColumn;
15use SqlSemantics\Platform\MySql\Statement\Call\Json\PathColumn;
16use SqlSemantics\Platform\MySql\Statement\Call\JsonTableColumn;
17
18#[CoversNothing]
19#[Small]
20final class JsonTableColumnTest extends TestCase
21{
22 public function testDeriveColumnsAnswersTheOutputSlots(): void
23 {
24 $platform = new Platform();
25 $derivation = new Derivation($platform->context($platform->profile('mysql-8.4.7', null, ParameterStyle::Native), null, [], false));
26 $slots = (new OrdinalityColumn(new Name('n')))->deriveColumns($derivation, $derivation->environment());
27
28 self::assertSame('n', $slots[0]->name?->value);
29 self::assertContains(JsonTableColumn::class, class_implements(PathColumn::class));
30 }
31}
32