feat: admin check steps with throwaway write test and reports

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-30 02:21:09 +02:00
co-authored by Claude Opus 5.5
parent c6a1996be6
commit 47040aa43d
14 changed files with 1026 additions and 26 deletions
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
use LIT\MCP\Integrations\Divi\BlockTree\Block;
use LIT\MCP\Integrations\Divi\BlockTree\Parser;
use LIT\MCP\Integrations\Divi\Release\FormatCheck;
use PHPUnit\Framework\TestCase;
final class FormatCheckTest extends TestCase
{
/** parse_blocks() as WordPress would answer for well-formed Divi markup: the same names and nesting. */
private static function wordPress(): \Closure
{
$convert = static function (array $blocks) use (&$convert): array {
return array_map(static fn (Block $block): array => [
'blockName' => $block->name(),
'innerBlocks' => $convert($block->children()),
], $blocks);
};
return static fn (string $content): array => $convert((new Parser())->parse($content)->children());
}
public function testTheShippedReferenceRoundTripsAndMatchesWordPress(): void
{
self::assertSame([], (new FormatCheck(null, self::wordPress()))->problems());
self::assertFileEquals(
dirname(__DIR__, 5) . '/tests/Fixtures/divi/converted-landing.html',
FormatCheck::REFERENCE
);
}
public function testADifferentStructureInWordPressIsReported(): void
{
$check = new FormatCheck(null, static fn (): array => [['blockName' => 'divi/section', 'innerBlocks' => []]]);
self::assertSame(['WordPress liest eine andere Blockstruktur als LIT MCP.'], $check->problems());
}
public function testAMissingReferenceIsReported(): void
{
self::assertSame(
['Der Referenzinhalt der Prüfung fehlt im Plugin.'],
(new FormatCheck('/nonexistent/reference.html', self::wordPress()))->problems()
);
}
}