packages/sql-semantics-mysql/tests/Unit/Statement/Partition/Bound/ValuesInRowsTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Partition\Bound;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Semantics;
11use SqlSemantics\Platform\MySql\Statement\Partition\Bound\ValuesInRows;
12
13#[CoversClass(ValuesInRows::class)]
14#[Medium]
15final class ValuesInRowsTest extends TestCase
16{
17    public function testDeriveBoundDerivesEveryTuple(): void
18    {
19        $alter = (new Semantics())->inspect('ALTER TABLE t ADD PARTITION (PARTITION p VALUES IN ((1, b), (c, 2)))');
20
21        self::assertCount(2, $alter->facts->diagnostics);
22    }
23
24    public function testRenderWritesTheTuples(): void
25    {
26        self::assertSame('ALTER TABLE t ADD PARTITION (PARTITION p VALUES IN ((1, 2), (3, 4)))', (new Semantics())->inspect('ALTER TABLE t ADD PARTITION (PARTITION p VALUES IN ((1,2),(3,4)))')->toString());
27    }
28}
29