packages/sql-semantics-mysql/tests/Unit/Statement/Server/Storage/Option/SizeOptionTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Server\Storage\Option;
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\Literal\ByteSize;
12use SqlSemantics\Platform\MySql\Statement\Literal\Numeral;
13use SqlSemantics\Platform\MySql\Statement\Server\Storage\Option\SizeOption;
14use SqlSemantics\Platform\MySql\Statement\Server\Storage\Option\SizeOptionKind;
15
16#[CoversClass(SizeOption::class)]
17#[Medium]
18final class SizeOptionTest extends TestCase
19{
20 public function testRenderWritesKeywordAndSize(): void
21 {
22 self::assertSame('ALTER TABLESPACE ts AUTOEXTEND_SIZE `4M` MAX_SIZE 1024', (new Semantics())->analyze('alter tablespace ts autoextend_size = 4M max_size 1024')->toString());
23 }
24
25 public function testKeywordAnswersTheKind(): void
26 {
27 self::assertSame('EXTENT_SIZE', (new SizeOption(SizeOptionKind::Extent, new ByteSize(new Numeral('1'))))->keyword());
28 }
29}
30