packages/sql-semantics-mysql/tests/Unit/Statement/Server/Storage/CreateUndoTablespaceTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Server\Storage;
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\Problem\StorageProblem;
12use SqlSemantics\Platform\MySql\Statement\Server\Storage\CreateUndoTablespace;
13
14#[CoversClass(CreateUndoTablespace::class)]
15#[Medium]
16final class CreateUndoTablespaceTest extends TestCase
17{
18 public function testRenderWritesTheRequest(): void
19 {
20 self::assertSame("CREATE UNDO TABLESPACE u ADD DATAFILE 'u.ibu' ENGINE innodb", (new Semantics())->inspect("create undo tablespace u add datafile 'u.ibu' engine innodb")->toString());
21 }
22
23 public function testDeriveStatementReportsRejectedOptions(): void
24 {
25 $operation = (new Semantics())->inspect("CREATE UNDO TABLESPACE u ADD DATAFILE 'u.ibu' ENGINE a ENGINE b");
26
27 self::assertInstanceOf(StorageProblem::class, $operation->facts->diagnostics[0]);
28 }
29}
30