From 3412e162cd9daffc577c54cad1ec192215221d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Turan=20Karatu=C4=9F?= Date: Tue, 1 Jul 2025 15:33:21 +0300 Subject: [PATCH 1/2] chore: Update PHPUnit version constraint in composer.json to support version 12.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b109835..0dbf8fd 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "orchestra/testbench": "^8.0 || ^9.0", "pestphp/pest": "^2.0", "pestphp/pest-plugin-laravel": "^2.0", - "phpunit/phpunit": "^10.0 || ^11.0" + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0" }, "autoload": { "psr-4": { From e826dd63f3cb21c6c335daeff160fad1dd71a477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Turan=20Karatu=C4=9F?= Date: Tue, 1 Jul 2025 15:33:32 +0300 Subject: [PATCH 2/2] refactor: Update handler assertions in ManualRegistrationTest - Changed assertions in ManualRegistrationTest to verify handler as an array containing the handler class and method instead of separate properties. - Updated tests to reflect the new structure for handler registration, ensuring consistency across tool, resource, and prompt registrations. --- tests/Feature/ManualRegistrationTest.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tests/Feature/ManualRegistrationTest.php b/tests/Feature/ManualRegistrationTest.php index 423d756..72bb15d 100644 --- a/tests/Feature/ManualRegistrationTest.php +++ b/tests/Feature/ManualRegistrationTest.php @@ -31,8 +31,7 @@ public function test_can_manually_register_a_tool() $this->assertInstanceOf(RegisteredTool::class, $tool); $this->assertEquals('manual_test_tool', $tool->schema->name); $this->assertEquals('A manually registered test tool.', $tool->schema->description); - $this->assertEquals(ManualTestHandler::class, $tool->handlerClass); - $this->assertEquals('handleTool', $tool->handlerMethod); + $this->assertEquals([ManualTestHandler::class, 'handleTool'], $tool->handler); $this->assertArrayHasKey('input', $tool->schema->inputSchema['properties']); $this->assertEquals('string', $tool->schema->inputSchema['properties']['input']['type']); } @@ -52,8 +51,7 @@ public function test_can_manually_register_tool_using_handler_only() $tool = $registry->getTool('handleTool'); $this->assertNotNull($tool); - $this->assertEquals(ManualTestHandler::class, $tool->handlerClass); - $this->assertEquals('handleTool', $tool->handlerMethod); + $this->assertEquals([ManualTestHandler::class, 'handleTool'], $tool->handler); $this->assertEquals('A sample tool handler.', $tool->schema->description); } @@ -82,8 +80,7 @@ public function test_can_manually_register_a_resource() $this->assertEquals('application/json', $resource->schema->mimeType); $this->assertEquals(1024, $resource->schema->size); $this->assertEquals(['priority' => 0.8], $resource->schema->annotations->toArray()); - $this->assertEquals(ManualTestHandler::class, $resource->handlerClass); - $this->assertEquals('handleResource', $resource->handlerMethod); + $this->assertEquals([ManualTestHandler::class, 'handleResource'], $resource->handler); } public function test_can_manually_register_a_prompt_with_invokable_class_handler() @@ -104,8 +101,7 @@ public function test_can_manually_register_a_prompt_with_invokable_class_handler $this->assertInstanceOf(RegisteredPrompt::class, $prompt); $this->assertEquals('manual_invokable_prompt', $prompt->schema->name); $this->assertEquals('A prompt handled by an invokable class.', $prompt->schema->description); - $this->assertEquals(ManualTestInvokableHandler::class, $prompt->handlerClass); - $this->assertEquals('__invoke', $prompt->handlerMethod); + $this->assertEquals(ManualTestInvokableHandler::class, $prompt->handler); } public function test_can_manually_register_a_resource_template_via_facade() @@ -130,7 +126,6 @@ public function test_can_manually_register_a_resource_template_via_facade() $this->assertEquals('manual_item_details_template', $template->schema->name); $this->assertEquals('A sample resource template handler.', $template->schema->description); $this->assertEquals('application/vnd.api+json', $template->schema->mimeType); - $this->assertEquals(ManualTestHandler::class, $template->handlerClass); - $this->assertEquals('handleTemplate', $template->handlerMethod); + $this->assertEquals([ManualTestHandler::class, 'handleTemplate'], $template->handler); } }