Skip to content

Add PHPUnit 12 support and fix test compatibility issues #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
15 changes: 5 additions & 10 deletions tests/Feature/ManualRegistrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand All @@ -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);
}

Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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);
}
}