Files
Inventory/tests/Mcp/Tool/Document/DocumentToolsTest.php
Matthieu 4340a0e13e feat(mcp) : add business tools — search, history, comments, custom fields, documents, model types
- search_inventory: global search across all 6 entity types
- get_entity_history + get_activity_log: audit trail access
- 4 comment tools: list, create, resolve, unresolved count
- 3 custom field tools: list values, upsert, delete
- 2 document tools: list, delete (upload via REST only)
- 6 model type tools: list, get, create, update, delete, sync
- 69 MCP tests pass total

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 15:00:37 +01:00

42 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Tests\Mcp\Tool\Document;
use App\Tests\AbstractApiTestCase;
/**
* @internal
*/
class DocumentToolsTest extends AbstractApiTestCase
{
public function testListDocuments(): void
{
$site = $this->createSite(name: 'Doc Site');
$session = $this->createMcpClient('ROLE_VIEWER');
$data = $this->callMcpTool($session, 'list_documents', [
'entityType' => 'site',
'entityId' => $site->getId(),
]);
$this->assertArrayHasKey('_parsed', $data);
$this->assertSame('site', $data['_parsed']['entityType']);
$this->assertSame($site->getId(), $data['_parsed']['entityId']);
$this->assertIsArray($data['_parsed']['items']);
$this->assertSame(0, $data['_parsed']['total']);
}
public function testDeleteDocumentRequiresGestionnaire(): void
{
$session = $this->createMcpClient('ROLE_VIEWER');
$data = $this->callMcpTool($session, 'delete_document', [
'documentId' => 'nonexistent-id',
]);
$this->assertArrayHasKey('error', $data);
}
}