feat: lit/library-save creates library entries like Divi (E4)
Reuses NewDraft for insert and rollback (P6), requires edit_global_library for scope global (P7), refuses opaque and global roots before wrapping (P11) and checks the node with StoredNodeGuard. The source page is never written. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,4 +62,26 @@ final class NewDraftTest extends TestCase
|
||||
self::assertSame(NewDraft::REASON_EXTRAS, $e->reason);
|
||||
}
|
||||
}
|
||||
|
||||
/** lit/library-save reuses the transaction without a PostWriter and names its entry (ruling P6). */
|
||||
public function testWithoutAWriterOnlyTheEntryIsDeletedAndPartialsNameTheEntry(): void
|
||||
{
|
||||
Functions\when('wp_delete_post')->justReturn(false);
|
||||
$log = FakeChangeLog::partialsOnly();
|
||||
$draft = new NewDraft(null, $log, 'lit/library-save', 'et_pb_layout', 'Bibliothekseintrag');
|
||||
|
||||
try {
|
||||
$draft->discard(2001, new RuntimeException('layout kaputt'), 'Grund.');
|
||||
self::fail('WriteFailed expected');
|
||||
} catch (WriteFailed $e) {
|
||||
self::assertFalse($e->rolledBack);
|
||||
self::assertSame(2001, $e->postId);
|
||||
}
|
||||
$log->assertPartials([
|
||||
'ability' => 'lit/library-save',
|
||||
'object_type' => 'et_pb_layout',
|
||||
'object_id' => '2001',
|
||||
'summary' => 'Bibliothekseintrag 2001: Anlegen nur teilweise zurückgenommen',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user