packages/sql-semantics-mysql/tests/Unit/Statement/Replication/Reset/ResetReplicaTest.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\ResetReplica;
14use SqlSemantics\Platform\MySql\Statement\Replication\Terminology;
15
16#[CoversClass(ResetReplica::class)]
17#[Medium]
18final class ResetReplicaTest extends TestCase
19{
20 public function testDeriveTargetRejectsTheVocabularyOfAnotherRelease(): void
21 {
22 $this->expectExceptionMessage('RESET REPLICA is written in the vocabulary of the release.');
23
24 new Operation((new Semantics('mysql-5.7.44'))->context([]), new Reset([new ResetReplica(Terminology::Current)]));
25 }
26
27 public function testRenderWritesTheLegacySpellingWithChannel(): void
28 {
29 self::assertSame("RESET SLAVE ALL FOR CHANNEL 'c'", (new Semantics('mysql-5.7.44'))->analyze("reset slave all for channel 'c'")->toString());
30 }
31}
32