Skip to content

Commit 88403cf

Browse files
committed
Add more inspector tests for functionality tests of STDIO examples
1 parent 42b5261 commit 88403cf

33 files changed

+286
-15
lines changed

examples/stdio-custom-dependencies/McpTaskHandlers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
use Mcp\Capability\Attribute\McpResource;
1515
use Mcp\Capability\Attribute\McpTool;
16-
use Mcp\Example\DependenciesStdioExample\Service\StatsServiceInterface;
17-
use Mcp\Example\DependenciesStdioExample\Service\TaskRepositoryInterface;
16+
use Mcp\Example\StdioCustomDependencies\Service\StatsServiceInterface;
17+
use Mcp\Example\StdioCustomDependencies\Service\TaskRepositoryInterface;
1818
use Psr\Log\LoggerInterface;
1919

2020
/**

examples/stdio-custom-dependencies/Service/InMemoryTaskRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Mcp\Example\DependenciesStdioExample\Service;
12+
namespace Mcp\Example\StdioCustomDependencies\Service;
1313

1414
use Psr\Log\LoggerInterface;
1515

examples/stdio-custom-dependencies/Service/StatsServiceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Mcp\Example\DependenciesStdioExample\Service;
12+
namespace Mcp\Example\StdioCustomDependencies\Service;
1313

1414
interface StatsServiceInterface
1515
{

examples/stdio-custom-dependencies/Service/SystemStatsService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Mcp\Example\DependenciesStdioExample\Service;
12+
namespace Mcp\Example\StdioCustomDependencies\Service;
1313

1414
final class SystemStatsService implements StatsServiceInterface
1515
{

examples/stdio-custom-dependencies/Service/TaskRepositoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Mcp\Example\DependenciesStdioExample\Service;
12+
namespace Mcp\Example\StdioCustomDependencies\Service;
1313

1414
/**
1515
* @phpstan-type Task array{id: int, userId: string, description: string, completed: bool, createdAt: string}

examples/stdio-custom-dependencies/server.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
require_once dirname(__DIR__).'/bootstrap.php';
1414
chdir(__DIR__);
1515

16-
use Mcp\Example\DependenciesStdioExample\Service\InMemoryTaskRepository;
17-
use Mcp\Example\DependenciesStdioExample\Service\StatsServiceInterface;
18-
use Mcp\Example\DependenciesStdioExample\Service\SystemStatsService;
19-
use Mcp\Example\DependenciesStdioExample\Service\TaskRepositoryInterface;
16+
use Mcp\Example\StdioCustomDependencies\Service\InMemoryTaskRepository;
17+
use Mcp\Example\StdioCustomDependencies\Service\StatsServiceInterface;
18+
use Mcp\Example\StdioCustomDependencies\Service\SystemStatsService;
19+
use Mcp\Example\StdioCustomDependencies\Service\TaskRepositoryInterface;
2020
use Mcp\Server;
2121
use Mcp\Server\Transport\StdioTransport;
2222

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the official PHP MCP SDK.
5+
*
6+
* A collaboration between Symfony and the PHP Foundation.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Inspector;
13+
14+
use Mcp\Tests\Inspector\InspectorSnapshotTestCase;
15+
16+
final class StdioCachedDiscoveryTest extends InspectorSnapshotTestCase
17+
{
18+
public static function provideMethods(): array
19+
{
20+
return [
21+
...parent::provideListMethods(),
22+
];
23+
}
24+
25+
protected function getServerScript(): string
26+
{
27+
return \dirname(__DIR__, 2).'/examples/stdio-cached-discovery/server.php';
28+
}
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the official PHP MCP SDK.
5+
*
6+
* A collaboration between Symfony and the PHP Foundation.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Inspector;
13+
14+
use Mcp\Tests\Inspector\InspectorSnapshotTestCase;
15+
16+
final class StdioCustomDependenciesTest extends InspectorSnapshotTestCase
17+
{
18+
public static function provideMethods(): array
19+
{
20+
return [
21+
...parent::provideListMethods(),
22+
];
23+
}
24+
25+
protected function getServerScript(): string
26+
{
27+
return \dirname(__DIR__, 2).'/examples/stdio-custom-dependencies/server.php';
28+
}
29+
}

tests/Inspector/StdioCalculatorExampleTest.php renamed to tests/Inspector/StdioDiscoveryCalculatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Mcp\Tests\Inspector;
1313

14-
final class StdioCalculatorExampleTest extends InspectorSnapshotTestCase
14+
final class StdioDiscoveryCalculatorTest extends InspectorSnapshotTestCase
1515
{
1616
public static function provideMethods(): array
1717
{
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the official PHP MCP SDK.
5+
*
6+
* A collaboration between Symfony and the PHP Foundation.
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Inspector;
13+
14+
use Mcp\Tests\Inspector\InspectorSnapshotTestCase;
15+
16+
final class StdioEnvVariablesTest extends InspectorSnapshotTestCase
17+
{
18+
public static function provideMethods(): array
19+
{
20+
return [
21+
...parent::provideListMethods(),
22+
];
23+
}
24+
25+
protected function getServerScript(): string
26+
{
27+
return \dirname(__DIR__, 2).'/examples/stdio-env-variables/server.php';
28+
}
29+
}

0 commit comments

Comments
 (0)