feat: wp lit-mcp divi-check with diff and reference update

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-30 02:52:17 +02:00
co-authored by Claude Opus 5.5
parent b441febd81
commit ed806a1cc8
5 changed files with 488 additions and 0 deletions
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Release;
use LIT\MCP\Integrations\Divi\Release\LineDiff;
use PHPUnit\Framework\TestCase;
final class LineDiffTest extends TestCase
{
public function testShowsChangedLinesWithTwoLinesOfContext(): void
{
$old = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'];
$new = ['a', 'b', 'c', 'd', 'E', 'f', 'g', 'h', 'i', 'j'];
self::assertSame(
[' c', ' d', '- e', '+ E', ' f', ' g', ' h', ' i', '+ j'],
LineDiff::lines($old, $new)
);
}
public function testMarksAGapBetweenDistantChanges(): void
{
$old = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'];
$new = ['A', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'J'];
self::assertSame(['- a', '+ A', ' b', ' c', '…', ' h', ' i', '- j', '+ J'], LineDiff::lines($old, $new));
}
public function testEqualInputHasNoLines(): void
{
self::assertSame([], LineDiff::lines(['a', 'b'], ['a', 'b']));
}
}