feat: Divi save pipeline – tree_rev lock, kses-safe save, revision, flags, cache, ToolResult

DiviSaver/DiviWriter/DiviComposition/DiviChange, WpValueSanitizer (S4),
WpMediaResolver, DiviFlags (S11), DynamicContentMap from Divi's live
registry (S22), S31 wiring, S35 control strip at apply() entry.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 14:56:47 +02:00
co-authored by Claude Opus 5.5
parent ea1fd607b2
commit 7762b76305
20 changed files with 1716 additions and 2 deletions
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Pages;
use Brain\Monkey\Functions;
use LIT\MCP\Integrations\Divi\Pages\DiviFlags;
use LIT\MCP\Tests\Unit\TestCase;
use RuntimeException;
final class DiviFlagsTest extends TestCase
{
public function testSetsBothFlagsAndAcceptsAnUnchangedValue(): void
{
$written = [];
// update_post_meta() is false when the value is already "on" – no failure (ruling S11).
Functions\when('update_post_meta')->alias(static function (int $id, string $key, string $value) use (&$written): bool {
$written[] = "$id:$key=$value";
return false;
});
Functions\when('get_post_meta')->justReturn('on');
DiviFlags::set(7);
self::assertSame(['7:_et_pb_use_divi_5=on', '7:_et_pb_use_builder=on'], $written);
}
public function testThrowsWhenAFlagDoesNotReadBack(): void
{
Functions\when('update_post_meta')->justReturn(true);
Functions\when('get_post_meta')->alias(
static fn (int $id, string $key): string => $key === '_et_pb_use_builder' ? 'off' : 'on'
);
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('_et_pb_use_builder');
DiviFlags::set(7);
}
}