|  | 
| 1 | 1 | <?php | 
| 2 | 2 | 
 | 
| 3 | 3 | use Laravel\Boost\Mcp\ToolExecutor; | 
| 4 |  | -use Laravel\Boost\Mcp\Tools\ApplicationInfo; | 
| 5 | 4 | use Laravel\Boost\Mcp\Tools\GetConfig; | 
| 6 | 5 | use Laravel\Boost\Mcp\Tools\Tinker; | 
| 7 | 6 | use Laravel\Mcp\Server\Tools\ToolResult; | 
| @@ -136,36 +135,36 @@ function buildSubprocessCommand(string $toolClass, array $arguments): array | 
| 136 | 135 | test('respects custom timeout parameter', function () { | 
| 137 | 136 |     $executor = Mockery::mock(ToolExecutor::class)->makePartial() | 
| 138 | 137 |         ->shouldAllowMockingProtectedMethods(); | 
| 139 |  | -     | 
|  | 138 | + | 
| 140 | 139 |     $executor->shouldReceive('buildCommand') | 
| 141 | 140 |         ->andReturnUsing(fn ($toolClass, $arguments) => buildSubprocessCommand($toolClass, $arguments)); | 
| 142 | 141 | 
 | 
| 143 | 142 |     // Test with custom timeout - should succeed with fast code | 
| 144 | 143 |     $result = $executor->execute(Tinker::class, [ | 
| 145 | 144 |         'code' => 'return "timeout test";', | 
| 146 |  | -        'timeout' => 30 | 
|  | 145 | +        'timeout' => 30, | 
| 147 | 146 |     ]); | 
| 148 | 147 | 
 | 
| 149 | 148 |     expect($result->isError)->toBeFalse(); | 
| 150 | 149 | }); | 
| 151 | 150 | 
 | 
| 152 | 151 | test('clamps timeout values correctly', function () { | 
| 153 | 152 |     $executor = new ToolExecutor(); | 
| 154 |  | -     | 
|  | 153 | + | 
| 155 | 154 |     // Test timeout clamping using reflection to access protected method | 
| 156 | 155 |     $reflection = new ReflectionClass($executor); | 
| 157 | 156 |     $method = $reflection->getMethod('getTimeout'); | 
| 158 | 157 |     $method->setAccessible(true); | 
| 159 |  | -     | 
|  | 158 | + | 
| 160 | 159 |     // Test default | 
| 161 | 160 |     expect($method->invoke($executor, []))->toBe(180); | 
| 162 |  | -     | 
|  | 161 | + | 
| 163 | 162 |     // Test custom value | 
| 164 | 163 |     expect($method->invoke($executor, ['timeout' => 60]))->toBe(60); | 
| 165 |  | -     | 
|  | 164 | + | 
| 166 | 165 |     // Test minimum clamp | 
| 167 | 166 |     expect($method->invoke($executor, ['timeout' => 0]))->toBe(1); | 
| 168 |  | -     | 
|  | 167 | + | 
| 169 | 168 |     // Test maximum clamp | 
| 170 | 169 |     expect($method->invoke($executor, ['timeout' => 1000]))->toBe(600); | 
| 171 | 170 | }); | 
0 commit comments