feat: StoredNodeGuard keeps S7/S26 for nodes moving between posts (E6)
Refuses, for users without unfiltered_html, non-Divi blocks, raw text parts, unreadable opaque blocks, code modules, builder-only paths (also below the state value), strings that are not sanitizer-stable and stored $variable references that VariableRef::canonical() refuses or would change (P2, P3). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ use LIT\MCP\Integrations\Divi\BlockTree\AttrMap;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Block;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\Document;
|
||||
use LIT\MCP\Integrations\Divi\BlockTree\NodeIndex;
|
||||
use LIT\MCP\Integrations\Divi\Compose\StoredNodeGuard;
|
||||
use LIT\MCP\Integrations\Divi\Compose\TreeEditor;
|
||||
use LIT\MCP\Integrations\Divi\Compose\VariableRef;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemReader;
|
||||
@@ -16,6 +17,7 @@ use LIT\MCP\Integrations\Divi\Pages\DynamicContentMap;
|
||||
use LIT\MCP\Integrations\Divi\Schema\DiviModules;
|
||||
use LIT\MCP\Tests\Support\ComposeFixture;
|
||||
use LIT\MCP\Tests\Support\DiviFixtures;
|
||||
use LIT\MCP\Tests\Support\DiviWriterFixture;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
use Mockery;
|
||||
|
||||
@@ -137,4 +139,21 @@ final class DiviCompositionTest extends TestCase
|
||||
self::assertSame([], $composition->warnings()->collect(NodeIndex::build(new Document()), []));
|
||||
self::assertInstanceOf(TreeEditor::class, $composition->editor());
|
||||
}
|
||||
|
||||
public function testStoredGuardSharesTheCleanerAndReferences(): void
|
||||
{
|
||||
$composition = DiviWriterFixture::composition(DiviWriterFixture::designReader())->forPost(7);
|
||||
$code = Block::create('divi/code', ['builderVersion' => '5.2.1']);
|
||||
|
||||
self::assertInstanceOf(StoredNodeGuard::class, $composition->storedGuard());
|
||||
self::assertSame(
|
||||
[],
|
||||
$composition->storedGuard()->problems(Block::create('divi/text', ['builderVersion' => '5.2.1']))
|
||||
);
|
||||
self::assertNotSame([], $composition->storedGuard()->problems($code), 'the editor sanitizer is used');
|
||||
self::assertSame(
|
||||
[],
|
||||
DiviWriterFixture::composition(DiviWriterFixture::designReader(), true)->storedGuard()->problems($code)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user