fix: final review minors m-1 to m-8

- m-1: the no-change Divi result carries preview_url/edit_url too
- m-2: overview names replace-text's per-page tree_rev
- m-3: divi-shortform documents validation_failed vs not_found for unknown IDs
- m-4: DiviWriter/DiviPageLoader final (no mocks left), neutral NewDraft
  log detail, snapshots are Etappe 4
- m-5: Tested up to 7.1, changelog completed
- m-6: content-create warns when the extras changed the stored layout
- m-7: deleting a whole section outlines nothing instead of the next one
- m-8: uninstall removes the user meta lit_mcp_log_per_page; readme lists it

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-26 19:35:24 +02:00
co-authored by Claude Opus 5.5
parent b24eb6c3e9
commit 097fef2e32
15 changed files with 136 additions and 21 deletions
@@ -105,10 +105,43 @@ final class DiviWriterTest extends TestCase
$writer = $this->writer($saver, FakeChangeLog::forbidden());
$page = $writer->page(['post_id' => 7, 'tree_rev' => Rev::of($content)]);
Functions\when('get_preview_post_link')->justReturn('https://kunde.test/?page_id=7&preview=true');
$result = $writer->save('lit/divi-update', $page, new DiviChange('nichts'), []);
self::assertSame(Rev::of($content), $result['tree_rev']);
self::assertStringStartsWith('Keine Änderung', $result['summary']);
// Review m-1: the same result shape as a save, URLs included.
self::assertSame('https://kunde.test/?page_id=7&et_fb=1', $result['edit_url']);
self::assertSame('https://kunde.test/?page_id=7&preview=true', $result['preview_url']);
}
/** Review m-7: a deleted whole section has no section left to outline (its ID now names the next one). */
public function testDeletingAWholeSectionOutlinesNothing(): void
{
$content = DiviFixtures::markup('synthetic-basic.html');
DiviFixtures::givenPost($content);
$saver = Mockery::mock(DiviSaver::class);
$saver->allows('save')->andReturnUsing(static function (WP_Post $post, string $new): array {
DiviFixtures::givenPost($new);
return ['revision_id' => 811, 'warnings' => []];
});
$input = ['post_id' => 7, 'tree_rev' => Rev::of($content)];
Functions\when('do_action')->justReturn(null);
Functions\when('get_preview_post_link')->justReturn('https://kunde.test/?page_id=7&preview=true');
$writer = $this->writer($saver, new FakeChangeLog(55));
$page = $writer->page($input);
$section = $page->index->find('s0');
$page->document->children()[0]->removeChild($section);
$result = $writer->save('lit/divi-delete', $page, (new DiviChange('gelöscht'))->removed('s0', $section), $input);
self::assertNull($result['outline']);
self::assertSame([['s0', 'divi/section', 'deleted']], array_map(
static fn (array $c): array => [$c['id'], $c['type'], $c['action']],
$result['changed']
));
}
public function testSavesAndReportsChangedNodesOutlineAndTheNewTreeRev(): void