Files
Inventory/tests/Mcp/Tool/DashboardStatsToolTest.php
Matthieu 4f1e136dc5 feat(mcp) : add CRUD tools for Sites, Constructeurs, Products
- 5 tools each: list, get, create, update, delete
- McpToolHelper extracted to AbstractApiTestCase for reuse
- DashboardStatsToolTest simplified to use base helpers
- 22 MCP tests pass

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

30 lines
830 B
PHP

<?php
declare(strict_types=1);
namespace App\Tests\Mcp\Tool;
use App\Tests\AbstractApiTestCase;
/**
* @internal
*/
class DashboardStatsToolTest extends AbstractApiTestCase
{
public function testGetDashboardStatsReturnsCounters(): void
{
$site = $this->createSite();
$this->createMachine(name: 'Machine Stats 1', site: $site);
$this->createMachine(name: 'Machine Stats 2', site: $site);
$session = $this->createMcpClient('ROLE_VIEWER');
$data = $this->callMcpTool($session, 'get_dashboard_stats');
$this->assertArrayHasKey('_parsed', $data);
$stats = $data['_parsed'];
$this->assertGreaterThanOrEqual(2, $stats['machines']);
$this->assertArrayHasKey('sites', $stats);
$this->assertArrayHasKey('unresolvedComments', $stats);
}
}