@@ -33,12 +33,12 @@ protected function getPackageProviders($app): array
3333 ]);
3434 }
3535
36- protected function setUp (): void
36+ protected function tearDown (): void
3737 {
38- parent ::setUp ();
38+ // Clear Restify repositories to prevent affecting subsequent tests
39+ Restify::$ repositories = [];
3940
40- // Clear any previously registered repositories to avoid test pollution
41- Restify::repositories ([]);
41+ parent ::tearDown ();
4242 }
4343
4444 public function test_repository_uses_mcp_specific_field_methods (): void
@@ -253,11 +253,15 @@ public function mcpAllowsIndex(): bool
253253
254254 // Find our expected tool name
255255 $ availableTools = collect ($ toolsData ['result ' ]['tools ' ])->pluck ('name ' )->toArray ();
256- $ indexToolName = collect ($ availableTools )->filter (fn ($ name ) => str_contains ($ name ,
257- 'test-posts ' ) && str_contains ($ name , 'index ' ))->first ();
256+ $ indexToolName = collect ($ availableTools )->filter (fn ($ name ) => str_contains (
257+ $ name ,
258+ 'test-posts '
259+ ) && str_contains ($ name , 'index ' ))->first ();
258260
259- $ this ->assertNotNull ($ indexToolName ,
260- 'Expected test-posts index tool not found. Available tools: ' .implode (', ' , $ availableTools ));
261+ $ this ->assertNotNull (
262+ $ indexToolName ,
263+ 'Expected test-posts index tool not found. Available tools: ' .implode (', ' , $ availableTools )
264+ );
261265
262266 // Create MCP JSON-RPC 2.0 request payload for calling the index tool
263267 $ mcpPayload = [
@@ -305,8 +309,11 @@ public function mcpAllowsIndex(): bool
305309 // Check structure - JSON:API format has 'attributes' key
306310 if (isset ($ firstItem ['type ' ]) && isset ($ firstItem ['id ' ])) {
307311 // JSON:API format - attributes should be in a sub-key
308- $ this ->assertArrayHasKey ('attributes ' , $ firstItem ,
309- 'Expected JSON:API structure with attributes key. Found keys: ' .implode (', ' , array_keys ($ firstItem )));
312+ $ this ->assertArrayHasKey (
313+ 'attributes ' ,
314+ $ firstItem ,
315+ 'Expected JSON:API structure with attributes key. Found keys: ' .implode (', ' , array_keys ($ firstItem ))
316+ );
310317 $ attributes = $ firstItem ['attributes ' ];
311318 } elseif (isset ($ firstItem ['attributes ' ])) {
312319 // Has attributes key but not standard JSON:API
@@ -418,8 +425,10 @@ public function mcpAllowsIndex(): bool
418425 fn ($ name ) => str_contains ($ name , 'test-posts-with-user ' ) && str_contains ($ name , 'index ' )
419426 )->first ();
420427
421- $ this ->assertNotNull ($ postIndexToolName ,
422- 'Expected test-posts-with-user index tool not found. Available tools: ' .implode (', ' , $ availableTools ));
428+ $ this ->assertNotNull (
429+ $ postIndexToolName ,
430+ 'Expected test-posts-with-user index tool not found. Available tools: ' .implode (', ' , $ availableTools )
431+ );
423432
424433 // Create MCP request with relationship inclusion
425434 $ mcpPayload = [
0 commit comments