1, 'slug' => 'host']; $item = (object) [ 'title' => 'Launch Post', 'slug' => 'launch-post', 'type' => 'post', 'status' => 'publish', 'author' => (object) ['name' => 'Virgil'], 'categories' => [(object) ['name' => 'News']], 'tags' => [(object) ['name' => 'Launch']], 'excerpt' => 'Big launch.', 'content_markdown' => '# Hello', 'created_at' => now(), 'updated_at' => now(), ]; $resource = new class($workspace, $item) extends ContentResource { public function __construct(private object $workspaceFixture, private object $itemFixture) { } protected function resolveWorkspace(string $identifier): ?object { return $this->workspaceFixture; } protected function resolveContentItem(object $workspace, string $identifier): ?object { return $this->itemFixture; } }; $content = $resource->handle(new Request(['uri' => 'content://host/launch-post']))->content; expect($content)->toContain("title: Launch Post") ->and($content)->toContain('> Big launch.') ->and($content)->toContain('# Hello'); }); test('ContentResource_handle_Bad_rejects_invalid_content_uris', function (): void { $resource = new class extends ContentResource {}; expect($resource->handle(new Request(['uri' => 'invalid://x']))->content) ->toBe('Invalid URI format. Expected: content://{workspace}/{slug}'); }); test('ContentResource_list_Ugly_can_be_overridden_to_surface_resource_lists_without_the_database', function (): void { $resource = new class extends ContentResource { protected function listResources(): array { return [[ 'uri' => 'content://host/launch-post', 'name' => 'Launch Post', 'description' => 'Post: Launch Post', 'mimeType' => 'text/markdown', ]]; } }; expect(mcpInvokeProtected($resource, 'listResources'))->toBe([[ 'uri' => 'content://host/launch-post', 'name' => 'Launch Post', 'description' => 'Post: Launch Post', 'mimeType' => 'text/markdown', ]]); });