|
4 | 4 | use Illuminate\Testing\TestResponse; |
5 | 5 | use Symfony\Component\Process\Process; |
6 | 6 |
|
| 7 | +use function Orchestra\Testbench\remote; |
| 8 | + |
7 | 9 | it('can initialize a connection over http', function (): void { |
8 | 10 | $response = $this->postJson('test-mcp', initializeMessage()); |
9 | 11 |
|
|
111 | 113 | }); |
112 | 114 |
|
113 | 115 | it('can initialize a connection over stdio', function (): void { |
114 | | - $process = new Process([PHP_BINARY, 'vendor/bin/testbench', 'mcp:start', 'test-mcp']); |
| 116 | + $process = remote(['mcp:start', 'test-mcp']); |
115 | 117 | $process->setInput(json_encode(initializeMessage())); |
116 | 118 |
|
117 | 119 | $process->run(function (string $type, string $output): void { |
|
122 | 124 | }); |
123 | 125 |
|
124 | 126 | it('can list tools over stdio', function (): void { |
125 | | - $process = new Process([PHP_BINARY, 'vendor/bin/testbench', 'mcp:start', 'test-mcp']); |
| 127 | + $process = remote(['mcp:start', 'test-mcp']); |
126 | 128 | $process->setInput(json_encode(listToolsMessage())); |
127 | 129 |
|
128 | 130 | $process->run(); |
|
133 | 135 | }); |
134 | 136 |
|
135 | 137 | it('can call a tool over stdio', function (): void { |
136 | | - $process = new Process([PHP_BINARY, 'vendor/bin/testbench', 'mcp:start', 'test-mcp']); |
| 138 | + $process = remote(['mcp:start', 'test-mcp']); |
137 | 139 | $process->setInput(json_encode(callToolMessage())); |
138 | 140 |
|
139 | 141 | $process->run(); |
|
144 | 146 | }); |
145 | 147 |
|
146 | 148 | it('can handle a ping over stdio', function (): void { |
147 | | - $process = new Process([PHP_BINARY, 'vendor/bin/testbench', 'mcp:start', 'test-mcp']); |
| 149 | + $process = remote(['mcp:start', 'test-mcp']); |
148 | 150 | $process->setInput(json_encode(pingMessage())); |
149 | 151 |
|
150 | 152 | $process->run(); |
|
155 | 157 | }); |
156 | 158 |
|
157 | 159 | it('can stream a tool response over stdio', function (): void { |
158 | | - $process = new Process([PHP_BINARY, 'vendor/bin/testbench', 'mcp:start', 'test-mcp']); |
| 160 | + $process = remote(['mcp:start', 'test-mcp']); |
159 | 161 | $process->setInput(json_encode(callStreamingToolMessage())); |
160 | 162 |
|
161 | 163 | $process->run(); |
|
0 commit comments