packages/sql-semantics-mysql/tests/Unit/Statement/Server/Storage/Option/CommentOptionTest.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\Text;
12use SqlSemantics\Platform\MySql\Statement\Server\Storage\Option\CommentOption;
13
14#[CoversClass(CommentOption::class)]
15#[Medium]
16final class CommentOptionTest extends TestCase
17{
18    public function testRenderWritesTheOption(): void
19    {
20        self::assertSame("CREATE TABLESPACE ts ADD DATAFILE 'f' COMMENT 'c'", (new Semantics())->analyze("create tablespace ts add datafile 'f' comment = 'c'")->toString());
21    }
22
23    public function testKeywordNamesTheOption(): void
24    {
25        self::assertSame('COMMENT', (new CommentOption(new Text('c')))->keyword());
26    }
27}
28