packages/sql-semantics-mysql/tests/Unit/Statement/Replication/Reset/ResetQueryCacheTest.php
1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Replication\Reset;
6
7use PHPUnit\Framework\Attributes\CoversClass;
8use PHPUnit\Framework\Attributes\Medium;
9use PHPUnit\Framework\TestCase;
10use SqlSemantics\Platform\MySql\Model\Statement\Operation;
11use SqlSemantics\Platform\MySql\Semantics;
12use SqlSemantics\Platform\MySql\Statement\Replication\Reset\Reset;
13use SqlSemantics\Platform\MySql\Statement\Replication\Reset\ResetQueryCache;
14
15#[CoversClass(ResetQueryCache::class)]
16#[Medium]
17final class ResetQueryCacheTest extends TestCase
18{
19 public function testDeriveTargetRejectsReleasesWithoutAQueryCache(): void
20 {
21 $this->expectExceptionMessage('RESET QUERY CACHE needs MySQL 5.6 or 5.7.');
22
23 new Operation((new Semantics())->context([]), new Reset([new ResetQueryCache()]));
24 }
25
26 public function testRenderWritesTheItem(): void
27 {
28 self::assertSame('RESET QUERY CACHE, MASTER', (new Semantics('mysql-5.6.51'))->analyze('reset query cache, master')->toString());
29 }
30}
31