packages/sql-semantics-mysql/tests/Unit/Statement/Utility/Show/Server/ShowEngineMutexTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Utility\Show\Server;
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\Utility\Show\Server\ShowEngineMutex;
12
13#[CoversClass(ShowEngineMutex::class)]
14#[Medium]
15final class ShowEngineMutexTest extends TestCase
16{
17 public function testDeriveStatementRecordsTheRows(): void
18 {
19 $show = (new Semantics('mysql-5.7.44'))->analyze('SHOW ENGINE innodb MUTEX');
20 self::assertInstanceOf(ShowEngineMutex::class, $show->statement);
21 self::assertSame('Type', $show->field(0)->name?->value);
22 }
23
24 public function testRenderWritesTheStatement(): void
25 {
26 self::assertSame('SHOW ENGINE innodb MUTEX', (new Semantics('mysql-5.7.44'))->analyze('SHOW ENGINE innodb MUTEX')->toString());
27 }
28}
29