feat: media usage finder and media-get tool
Usage search distinguishes certain (ID referenced) and possible (file URL only) usages, hides titles the user cannot read, and keeps queries bounded. MediaGuard checks per-attachment capabilities and refuses trashed media unless the caller opts in. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Tests\Unit\Integrations\Media;
|
||||
|
||||
use LIT\MCP\Abilities\Ability;
|
||||
use LIT\MCP\ChangeLog\ChangeLog;
|
||||
use LIT\MCP\Integrations\Media\MediaIntegration;
|
||||
use LIT\MCP\Integrations\WordPress\Schema\ContentSchema;
|
||||
use LIT\MCP\Limits;
|
||||
use LIT\MCP\Tests\Unit\TestCase;
|
||||
use Mockery;
|
||||
|
||||
final class MediaIntegrationTest extends TestCase
|
||||
{
|
||||
/** Grows with Tasks 2–5 – keep in the order of abilities(). */
|
||||
private const EXPECTED = [
|
||||
'lit/media-get',
|
||||
];
|
||||
|
||||
public function testProvidesTheMediaAbilities(): void
|
||||
{
|
||||
$integration = new MediaIntegration(Mockery::mock(ContentSchema::class), Mockery::mock(ChangeLog::class), new Limits());
|
||||
|
||||
self::assertSame('media', $integration->id());
|
||||
self::assertTrue($integration->isAvailable());
|
||||
self::assertSame(self::EXPECTED, array_map(static fn (Ability $a): string => $a->name(), $integration->abilities()));
|
||||
|
||||
foreach ($integration->abilities() as $ability) {
|
||||
self::assertFalse($ability->inputSchema()['additionalProperties'], $ability->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user