Files
WP-LIT-MCP/tests/Unit/Integrations/Divi/Pages/DiviWriteAbilityTest.php
T
janniclas.loosenandClaude Opus 5.5 7963aa19bd 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
2026-09-26 18:27:59 +02:00

25 lines
805 B
PHP

<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Pages;
use Brain\Monkey\Functions;
use WP_Error;
final class DiviWriteAbilityTest extends DiviWriteAbilityTestCase
{
/** Permission denied (edit_post false) for all three new abilities. */
public function testPermissionDeniedWhenNotEditable(): void
{
Functions\when('current_user_can')->justReturn(false);
foreach ([$this->move(), $this->delete(), $this->duplicate()] as $ability) {
$result = $ability->permission(['post_id' => 7, 'tree_rev' => $this->treeRev()]);
self::assertInstanceOf(WP_Error::class, $result, $ability->name());
self::assertToolError($result, 'forbidden', $ability->name());
}
self::assertSame([], $this->saved);
}
}