feat: Divi adapters for roles and library with a live compatibility check

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-27 00:51:09 +02:00
co-authored by Claude Opus 5.5
parent b389f983de
commit ce1ad7c6c3
10 changed files with 491 additions and 5 deletions
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Library;
use LIT\MCP\Integrations\Divi\Library\DiviRoles;
use LIT\MCP\Tests\Unit\TestCase;
final class DiviRolesTest extends TestCase
{
public function testAsksTheCheckAndExplainsARefusal(): void
{
$roles = new DiviRoles(static fn (string $cap): bool => $cap !== 'edit_global_library');
self::assertTrue($roles->allows('divi_library'));
self::assertNull($roles->refusal('divi_library'));
$refusal = $roles->refusal('edit_global_library');
self::assertToolError($refusal, 'forbidden');
self::assertStringContainsString('Globale Bibliothekselemente bearbeiten', $refusal->get_error_message());
self::assertStringContainsString('Rollen-Editor', $refusal->get_error_message());
}
public function testWithoutDiviNothingIsAllowed(): void
{
// Unit tests have no et_pb_is_allowed(): a missing Divi function never means "allowed".
self::assertFalse((new DiviRoles())->allows('divi_library'));
}
}