packages/sql-semantics-mysql/tests/Unit/Statement/Replication/Log/PurgeLogsToTest.php

1<?php
2
3declare(strict_types=1);
4
5namespace Tests\Unit\Statement\Replication\Log;
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\Replication\Log\PurgeLogsTo;
12
13#[CoversClass(PurgeLogsTo::class)]
14#[Medium]
15final class PurgeLogsToTest extends TestCase
16{
17    public function testDeriveStatementRecordsNoDiagnostic(): void
18    {
19        self::assertSame([], (new Semantics())->analyze("PURGE BINARY LOGS TO 'b.000001'")->facts->diagnostics);
20    }
21
22    public function testRenderWritesBinaryLogs(): void
23    {
24        self::assertSame("PURGE BINARY LOGS TO 'b.000001'", (new Semantics('mysql-8.3.0'))->analyze("purge master logs to 'b.000001'")->toString());
25    }
26}
27