2727
2828class ToolCallerTest extends TestCase
2929{
30- private ToolCaller $ toolExecutor ;
30+ private ToolCaller $ toolCaller ;
3131 private ReferenceProviderInterface |MockObject $ referenceProvider ;
3232 private ReferenceHandlerInterface |MockObject $ referenceHandler ;
3333 private LoggerInterface |MockObject $ logger ;
@@ -38,7 +38,7 @@ protected function setUp(): void
3838 $ this ->referenceHandler = $ this ->createMock (ReferenceHandlerInterface::class);
3939 $ this ->logger = $ this ->createMock (LoggerInterface::class);
4040
41- $ this ->toolExecutor = new ToolCaller (
41+ $ this ->toolCaller = new ToolCaller (
4242 $ this ->referenceProvider ,
4343 $ this ->referenceHandler ,
4444 $ this ->logger ,
@@ -78,7 +78,7 @@ public function testCallExecutesToolSuccessfully(): void
7878 )
7979 );
8080
81- $ result = $ this ->toolExecutor ->call ($ request );
81+ $ result = $ this ->toolCaller ->call ($ request );
8282
8383 $ this ->assertInstanceOf (CallToolResult::class, $ result );
8484 $ this ->assertCount (1 , $ result ->content );
@@ -109,7 +109,7 @@ public function testCallWithEmptyArguments(): void
109109 ->expects ($ this ->exactly (2 ))
110110 ->method ('debug ' );
111111
112- $ result = $ this ->toolExecutor ->call ($ request );
112+ $ result = $ this ->toolCaller ->call ($ request );
113113
114114 $ this ->assertInstanceOf (CallToolResult::class, $ result );
115115 }
@@ -139,7 +139,7 @@ public function testCallWithComplexArguments(): void
139139 ->with ($ toolReference , $ arguments )
140140 ->willReturn (['processed ' => true ]);
141141
142- $ result = $ this ->toolExecutor ->call ($ request );
142+ $ result = $ this ->toolCaller ->call ($ request );
143143
144144 $ this ->assertInstanceOf (CallToolResult::class, $ result );
145145 $ this ->assertCount (1 , $ result ->content );
@@ -172,7 +172,7 @@ public function testCallThrowsToolNotFoundExceptionWhenToolNotFound(): void
172172 $ this ->expectException (ToolNotFoundException::class);
173173 $ this ->expectExceptionMessage ('Tool not found for call: "nonexistent_tool". ' );
174174
175- $ this ->toolExecutor ->call ($ request );
175+ $ this ->toolCaller ->call ($ request );
176176 }
177177
178178 public function testCallThrowsToolExecutionExceptionWhenHandlerThrowsException (): void
@@ -216,7 +216,7 @@ public function testCallThrowsToolExecutionExceptionWhenHandlerThrowsException()
216216
217217 $ thrownException = null ;
218218 try {
219- $ this ->toolExecutor ->call ($ request );
219+ $ this ->toolCaller ->call ($ request );
220220 } catch (ToolCallException $ e ) {
221221 $ thrownException = $ e ;
222222 throw $ e ;
@@ -250,7 +250,7 @@ public function testCallHandlesNullResult(): void
250250 ->expects ($ this ->exactly (2 ))
251251 ->method ('debug ' );
252252
253- $ result = $ this ->toolExecutor ->call ($ request );
253+ $ result = $ this ->toolCaller ->call ($ request );
254254
255255 $ this ->assertInstanceOf (CallToolResult::class, $ result );
256256 $ this ->assertCount (1 , $ result ->content );
@@ -276,7 +276,7 @@ public function testCallHandlesBooleanResults(): void
276276 ->with ($ toolReference , [])
277277 ->willReturn (true );
278278
279- $ result = $ this ->toolExecutor ->call ($ request );
279+ $ result = $ this ->toolCaller ->call ($ request );
280280
281281 $ this ->assertInstanceOf (CallToolResult::class, $ result );
282282 $ this ->assertCount (1 , $ result ->content );
@@ -303,7 +303,7 @@ public function testCallHandlesArrayResults(): void
303303 ->with ($ toolReference , [])
304304 ->willReturn ($ arrayResult );
305305
306- $ result = $ this ->toolExecutor ->call ($ request );
306+ $ result = $ this ->toolCaller ->call ($ request );
307307
308308 $ this ->assertInstanceOf (CallToolResult::class, $ result );
309309 $ this ->assertCount (1 , $ result ->content );
@@ -333,7 +333,7 @@ public function testCallHandlesContentObjectResults(): void
333333 ->with ($ toolReference , [])
334334 ->willReturn ($ contentResult );
335335
336- $ result = $ this ->toolExecutor ->call ($ request );
336+ $ result = $ this ->toolCaller ->call ($ request );
337337
338338 $ this ->assertInstanceOf (CallToolResult::class, $ result );
339339 $ this ->assertCount (1 , $ result ->content );
@@ -365,7 +365,7 @@ public function testCallHandlesArrayOfContentResults(): void
365365 ->with ($ toolReference , [])
366366 ->willReturn ($ contentArray );
367367
368- $ result = $ this ->toolExecutor ->call ($ request );
368+ $ result = $ this ->toolCaller ->call ($ request );
369369
370370 $ this ->assertInstanceOf (CallToolResult::class, $ result );
371371 $ this ->assertCount (2 , $ result ->content );
@@ -407,7 +407,7 @@ public function testCallWithDifferentExceptionTypes(): void
407407 $ this ->expectException (ToolCallException::class);
408408 $ this ->expectExceptionMessage ('Tool call "error_tool" failed with error: "Invalid input". ' );
409409
410- $ this ->toolExecutor ->call ($ request );
410+ $ this ->toolCaller ->call ($ request );
411411 }
412412
413413 public function testCallLogsResultTypeCorrectlyForString (): void
@@ -432,7 +432,7 @@ public function testCallLogsResultTypeCorrectlyForString(): void
432432 ->expects ($ this ->exactly (2 ))
433433 ->method ('debug ' );
434434
435- $ result = $ this ->toolExecutor ->call ($ request );
435+ $ result = $ this ->toolCaller ->call ($ request );
436436
437437 $ this ->assertInstanceOf (CallToolResult::class, $ result );
438438 }
@@ -459,7 +459,7 @@ public function testCallLogsResultTypeCorrectlyForInteger(): void
459459 ->expects ($ this ->exactly (2 ))
460460 ->method ('debug ' );
461461
462- $ result = $ this ->toolExecutor ->call ($ request );
462+ $ result = $ this ->toolCaller ->call ($ request );
463463
464464 $ this ->assertInstanceOf (CallToolResult::class, $ result );
465465 }
@@ -486,7 +486,7 @@ public function testCallLogsResultTypeCorrectlyForArray(): void
486486 ->expects ($ this ->exactly (2 ))
487487 ->method ('debug ' );
488488
489- $ result = $ this ->toolExecutor ->call ($ request );
489+ $ result = $ this ->toolCaller ->call ($ request );
490490
491491 $ this ->assertInstanceOf (CallToolResult::class, $ result );
492492 }
@@ -517,7 +517,7 @@ public function testCallHandlesEmptyArrayResult(): void
517517 ->with ($ toolReference , [])
518518 ->willReturn ([]);
519519
520- $ result = $ this ->toolExecutor ->call ($ request );
520+ $ result = $ this ->toolCaller ->call ($ request );
521521
522522 $ this ->assertInstanceOf (CallToolResult::class, $ result );
523523 $ this ->assertCount (1 , $ result ->content );
@@ -549,7 +549,7 @@ public function testCallHandlesMixedContentAndNonContentArray(): void
549549 ->with ($ toolReference , [])
550550 ->willReturn ($ mixedResult );
551551
552- $ result = $ this ->toolExecutor ->call ($ request );
552+ $ result = $ this ->toolCaller ->call ($ request );
553553
554554 $ this ->assertInstanceOf (CallToolResult::class, $ result );
555555 // The ToolReference.formatResult should handle this mixed array
@@ -576,7 +576,7 @@ public function testCallHandlesStdClassResult(): void
576576 ->with ($ toolReference , [])
577577 ->willReturn ($ objectResult );
578578
579- $ result = $ this ->toolExecutor ->call ($ request );
579+ $ result = $ this ->toolCaller ->call ($ request );
580580
581581 $ this ->assertInstanceOf (CallToolResult::class, $ result );
582582 $ this ->assertCount (1 , $ result ->content );
@@ -602,7 +602,7 @@ public function testCallHandlesBooleanFalseResult(): void
602602 ->with ($ toolReference , [])
603603 ->willReturn (false );
604604
605- $ result = $ this ->toolExecutor ->call ($ request );
605+ $ result = $ this ->toolCaller ->call ($ request );
606606
607607 $ this ->assertInstanceOf (CallToolResult::class, $ result );
608608 $ this ->assertCount (1 , $ result ->content );
0 commit comments