feat: deferred 1a items - menu_rev lock, lit_mcp_guides filter, warnings, schedule guard precision
Task 14 (rulings P17/P18, Q10): - lit/menu-get returns menu_rev (Rev::ofMenu over id, parent, position, title, url, object, object_id); lit/menu-set-items requires it, refuses a stale one with rev_mismatch (hint: lit/menu-get) and returns the new menu_rev. Errors::revMismatch takes an optional message/hint. - GuideRepository: filter lit_mcp_guides adds/overrides topics; invalid topic names and non-string content are ignored, files stay the default. - lit/post-trash names front page, posts page and linking menus in the confirmation and as warnings; lit/menu-assign-location needs confirm to remove an assigned menu and names it; lit/post-schedule warns that a private entry becomes public; Divi hints no longer point to non-existing lit-divi-* tools. - PostGuard::missedSchedule: 60 s publish window, zero GMT date falls back to get_gmt_from_date(post_date); post-schedule refuses dates within that window. - write_failed after a clean rollback that keeps a revision/backup says "Die Aenderung wurde nicht gespeichert (... bleibt erhalten)" via the new state parameter (Errors::writeFailed / WriteFailed rolledBackState). - wp-basis-smoke: menu_rev flow, unassign confirm, trash/menu and private-schedule warnings. 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:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Guides;
|
||||
|
||||
use Brain\Monkey\Filters;
|
||||
use LIT\MCP\Guides\GuideRepository;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
|
||||
@@ -48,6 +49,40 @@ final class GuideRepositoryTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function testFilesAreTheDefaultWhenNoFilterIsRegistered(): void
|
||||
{
|
||||
Filters\expectApplied('lit_mcp_guides')->once()->with([])->andReturn([]);
|
||||
|
||||
self::assertSame(['divi-shortform', 'overview'], $this->guides->topics());
|
||||
self::assertStringContainsString('Testinhalt Kurzform', (string) $this->guides->get('divi-shortform'));
|
||||
}
|
||||
|
||||
public function testTheFilterAddsAndOverridesTopicsAndIgnoresInvalidNames(): void
|
||||
{
|
||||
Filters\expectApplied('lit_mcp_guides')->andReturn([
|
||||
'site-rules' => "# Regeln\n<b>as-is</b>",
|
||||
'overview' => 'Eigene Übersicht',
|
||||
'../../wp-config' => 'nope',
|
||||
'Upper' => 'nope',
|
||||
'not-string' => ['nope'],
|
||||
7 => 'nope',
|
||||
]);
|
||||
|
||||
self::assertSame(['divi-shortform', 'overview', 'site-rules'], $this->guides->topics());
|
||||
self::assertSame("# Regeln\n<b>as-is</b>", $this->guides->get('site-rules'));
|
||||
self::assertSame('Eigene Übersicht', $this->guides->get('overview'));
|
||||
self::assertNull($this->guides->get('../../wp-config'));
|
||||
self::assertNull($this->guides->get('Upper'));
|
||||
self::assertNull($this->guides->get('not-string'));
|
||||
}
|
||||
|
||||
public function testANonArrayFilterResultIsIgnored(): void
|
||||
{
|
||||
Filters\expectApplied('lit_mcp_guides')->andReturn('kaputt');
|
||||
|
||||
self::assertSame(['divi-shortform', 'overview'], $this->guides->topics());
|
||||
}
|
||||
|
||||
public function testMissingDirectoryYieldsNoTopics(): void
|
||||
{
|
||||
self::assertSame([], (new GuideRepository('/nonexistent/dir'))->topics());
|
||||
|
||||
Reference in New Issue
Block a user