feat: field validation, term resolution, post guard and revision points

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-25 22:29:15 +02:00
co-authored by Claude Opus 5.5
parent 98a910f056
commit 95aae74466
11 changed files with 748 additions and 0 deletions
@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\WordPress;
use Brain\Monkey\Functions;
use LIT\MCP\Integrations\WordPress\RevisionPoint;
use LIT\MCP\Tests\Unit\TestCase;
use WP_Post;
final class RevisionPointTest extends TestCase
{
public function testCaptureSavesARevisionAndReturnsTheNewest(): void
{
$order = [];
Functions\expect('wp_save_post_revision')->once()->with(5)->andReturnUsing(static function () use (&$order) {
$order[] = 'save';
return 811;
});
Functions\expect('wp_get_post_revisions')->once()->with(5, ['posts_per_page' => 1])
->andReturnUsing(static function () use (&$order): array {
$order[] = 'latest';
return [811 => new WP_Post(['ID' => 811, 'post_type' => 'revision'])];
});
self::assertSame(811, RevisionPoint::capture(5));
self::assertSame(['save', 'latest'], $order);
}
public function testLatestIsNullWithoutRevisions(): void
{
Functions\when('wp_get_post_revisions')->justReturn([]);
self::assertNull(RevisionPoint::latest(5));
}
}