test: split DiviWriteAbilitiesTest per tool (T5)

One test class per Divi write tool on a shared DiviWriteAbilityTestCase;
the 30 tests move verbatim (per-test assertion counts identical). Adds the
ledger T4 test for a TreeEditor::move() StructureRules refusal.

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 18:27:59 +02:00
co-authored by Claude Opus 5.5
parent afa19ffcd8
commit 7963aa19bd
9 changed files with 746 additions and 653 deletions
@@ -126,6 +126,27 @@ final class TreeEditorTest extends TestCase
self::assertSame($section, NodeIndex::build($document)->find('s1'));
}
/** Ledger T4: move() checks StructureRules for the target parent and leaves the tree unchanged when it refuses. */
public function testMoveChecksTheStructureRules(): void
{
$document = $this->document();
$original = Serializer::document($document);
$index = NodeIndex::build($document);
$editor = new TreeEditor(ComposeFixture::rules());
$button = $index->find('s0.r0.c1.m2');
self::assertSame(
'auf oberster Ebene sind nur Abschnitte (section) erlaubt',
$editor->move($index, $button, $editor->position($index, []))
);
self::assertStringContainsString('Zeilen', (string) $editor->move($index, $button, $editor->position($index, ['parent' => 's0'])));
self::assertStringContainsString('Spalten entstehen mit der Zeile', (string) $editor->move($index, $button, $editor->position($index, ['parent' => 's0.r0'])));
self::assertStringContainsString('accordion-item', (string) $editor->move($index, $button, $editor->position($index, ['parent' => 's1.r0.c1.m0'])));
self::assertSame($original, Serializer::document($document), 'a refused move changes nothing');
self::assertSame($button, NodeIndex::build($document)->find('s0.r0.c1.m2'));
}
public function testRemoveAndDuplicate(): void
{
$document = $this->document();