* style: apply php-cs-fixer to test files Addresses drift flagged by the default PHP-CS-Fixer config — mostly adds missing `: void` return types on pre-existing test methods. No behavioural changes. * fix: resolve phpstan errors surfaced by qa - Drop the obsolete `Method ::test*() has no return type specified` ignore rule — every test method now declares a return type, so the pattern never matches and phpstan reports it as unmatched. - Remove `?? []` from two reads of `CallToolRequest::$arguments`; the property is typed `array` (non-nullable), so the coalesce is a no-op that phpstan flags. --------- Co-authored-by: DDEV User <nobody@example.com>
58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the official PHP MCP SDK.
|
|
*
|
|
* A collaboration between Symfony and the PHP Foundation.
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Mcp\Tests\Unit\Schema\JsonRpc;
|
|
|
|
use Mcp\Schema\JsonRpc\Request;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class RequestTest extends TestCase
|
|
{
|
|
public function testMetaAndIdAreLoopedThrough(): void
|
|
{
|
|
$requestImplementation = new class extends Request {
|
|
public static function getMethod(): string
|
|
{
|
|
return 'foo/bar';
|
|
}
|
|
|
|
public static function fromParams(?array $params): static
|
|
{
|
|
return new self();
|
|
}
|
|
|
|
protected function getParams(): ?array
|
|
{
|
|
return null;
|
|
}
|
|
};
|
|
|
|
$notification = $requestImplementation::fromArray([
|
|
'jsonrpc' => '2.0',
|
|
'id' => '12345',
|
|
'method' => 'foo/bar',
|
|
'params' => [
|
|
'_meta' => ['key' => 'value'],
|
|
],
|
|
]);
|
|
|
|
$expectedMeta = [
|
|
'jsonrpc' => '2.0',
|
|
'id' => '12345',
|
|
'method' => 'foo/bar',
|
|
'params' => [
|
|
'_meta' => ['key' => 'value'],
|
|
],
|
|
];
|
|
|
|
$this->assertSame($expectedMeta, $notification->jsonSerialize());
|
|
}
|
|
}
|