feat: lit/divi-presets-set – Presets anlegen und ändern mit Probelauf und Snapshot
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
341782a34f
commit
b3c3e69a53
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Divi\Design;
|
||||
|
||||
use Brain\Monkey\Functions;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignRights;
|
||||
use LIT\MCP\Integrations\Divi\Design\DesignSystemWriter;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
use Mockery;
|
||||
|
||||
final class DesignRightsTest extends TestCase
|
||||
{
|
||||
public function testPresetsNeedEditThemeOptionsAndTheVisualBuilder(): void
|
||||
{
|
||||
$writer = Mockery::mock(DesignSystemWriter::class);
|
||||
$writer->allows('canUseVisualBuilder')->andReturn(true, false);
|
||||
Functions\when('current_user_can')->alias(static fn (string $cap): bool => $cap === 'edit_theme_options');
|
||||
|
||||
self::assertNull(DesignRights::presets($writer));
|
||||
$refusal = self::assertToolError(DesignRights::presets($writer), 'forbidden');
|
||||
self::assertStringContainsString('Visual Builder', $refusal['message']);
|
||||
|
||||
Functions\when('current_user_can')->justReturn(false);
|
||||
$refusal = self::assertToolError(DesignRights::presets($writer), 'forbidden');
|
||||
self::assertStringContainsString('edit_theme_options', $refusal['message']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user