packages/sql-semantics-mysql/tests/Unit/Statement/Server/Storage/Option/StorageOptionTest.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\Server\Storage\CreateTablespace;
12use SqlSemantics\Platform\MySql\Statement\Server\Storage\Option\StorageOption;
13
14#[CoversClass(StorageOption::class)]
15#[Medium]
16final class StorageOptionTest extends TestCase
17{
18    public function testKeywordNamesTheOption(): void
19    {
20        $create = (new Semantics())->analyze("CREATE TABLESPACE ts ADD DATAFILE 'f' ENGINE ndb NO_WAIT");
21        self::assertInstanceOf(CreateTablespace::class, $create->statement);
22
23        self::assertSame(['ENGINE', 'WAIT'], [$create->statement->options[0]->keyword(), $create->statement->options[1]->keyword()]);
24    }
25}
26