packages/sql-semantics-mysql/tests/Unit/Lowering/Server/Instance/PluginRuleTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Lowering\Server\Instance;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Lowering\Server\Instance\PluginRule;
11use SqlSemantics\Platform\MySql\Semantics;
12
13#[CoversClass(PluginRule::class)]
14#[Medium]
15final class PluginRuleTest extends TestCase
16{
17 public function testStatementLowersComponents(): void
18 {
19 self::assertSame("UNINSTALL COMPONENT 'a', 'b'", (new Semantics())->analyze("uninstall component 'a', 'b'")->toString());
20 }
21
22 public function testSettingsLowersTheList(): void
23 {
24 self::assertSame("INSTALL COMPONENT 'a' SET a.x = 1, GLOBAL a.y = ON", (new Semantics())->analyze("install component 'a' set a.x = 1, global a.y = on")->toString());
25 }
26
27 public function testSettingLowersPersist(): void
28 {
29 self::assertSame("INSTALL COMPONENT 'a' SET PERSIST x = 2", (new Semantics('mysql-9.1.0'))->analyze("install component 'a' set persist x := 2")->toString());
30 }
31}
32