packages/sql-semantics-mysql/tests/Unit/Statement/Partition/Bound/PartitionRowTest.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\PartitionRow;
12
13#[CoversClass(PartitionRow::class)]
14#[Medium]
15final class PartitionRowTest extends TestCase
16{
17    public function testDeriveRowDerivesTheValuesWithoutColumns(): void
18    {
19        self::assertSame('Column a does not exist.', (new Semantics())->inspect('ALTER TABLE t PARTITION BY RANGE (a) (PARTITION p VALUES LESS THAN (a))')->facts->diagnostics[0]->message());
20    }
21
22    public function testRenderWritesTheValues(): void
23    {
24        self::assertSame('ALTER TABLE t ADD PARTITION (PARTITION p VALUES LESS THAN (1, MAXVALUE))', (new Semantics())->inspect('ALTER TABLE t ADD PARTITION (PARTITION p VALUES LESS THAN (1, MAXVALUE))')->toString());
25    }
26}
27