Adds Einstellungen → LIT MCP → Tools (direct/indirect/disabled per ability, only ExposurePolicy-allowed modes offered) and → Limits (upload size, log retention, snapshot count), wired into Plugin.php. Ruling Q11b (carried from task 6): overview.md notes that direct visibility is configurable; hints in src/ that name a tool which is direct by default but can be switched to indirect (content-get, content-query, content-types, post-publish, media-search) now use the neutral "lit/<name> (direkt: lit-<name>)" form so they stay correct after an admin override. lit/guide (always direct) and the media-preview/-download DIRECT_ONLY tools are unaffected. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
44 lines
1.4 KiB
PHP
44 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace LIT\MCP\Tests\Unit\Admin;
|
|
|
|
use Brain\Monkey\Functions;
|
|
use LIT\MCP\Admin\LimitsTab;
|
|
use LIT\MCP\Limits;
|
|
use LIT\MCP\Tests\Unit\TestCase;
|
|
use Mockery;
|
|
|
|
final class LimitsTabTest extends TestCase
|
|
{
|
|
public function testRegistersTheLimitsOption(): void
|
|
{
|
|
Functions\expect('register_setting')->once()->with(
|
|
'lit_mcp_limits',
|
|
'lit_mcp_limits',
|
|
Mockery::on(static fn (array $args): bool => $args['sanitize_callback'] === [Limits::class, 'sanitize']
|
|
&& $args['default'] === Limits::DEFAULTS)
|
|
);
|
|
|
|
(new LimitsTab())->registerSettings();
|
|
}
|
|
|
|
public function testRendersThreeNumberFieldsWithCurrentValues(): void
|
|
{
|
|
Functions\stubEscapeFunctions();
|
|
Functions\stubTranslationFunctions();
|
|
Functions\when('settings_fields')->justReturn(null);
|
|
Functions\when('submit_button')->justReturn(null);
|
|
Functions\when('get_option')->justReturn(['upload_mb' => 8]);
|
|
|
|
ob_start();
|
|
(new LimitsTab())->render();
|
|
$html = (string) ob_get_clean();
|
|
|
|
self::assertSame(3, substr_count($html, 'type="number"'));
|
|
self::assertStringContainsString('name="lit_mcp_limits[upload_mb]" value="8"', $html);
|
|
self::assertStringContainsString('name="lit_mcp_limits[log_retention_days]" value="90"', $html);
|
|
}
|
|
}
|