php-sdk/tests/Unit/Schema
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Dev 206aa9da52
[Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version (#393)
* [Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version

`empty()` treats the string "0" as empty, so a valid clientInfo/serverInfo
with `"version": "0"` (or `"name": "0"`) was rejected with an
InvalidArgumentException. During initialize this aborted request parsing and
surfaced as a misleading "A valid session id is REQUIRED" error.

Replace the `empty()` guards with explicit isset/is_string/empty-string checks
so genuinely missing, non-string, and empty values are still rejected while
"0" is accepted. Adds ImplementationTest covering the regression and the
existing validation paths.

Fixes #392

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* [Schema] Suppress PHPStan argument.type on invalid-input tests

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 23:41:51 +02:00
..
Elicitation CS update after release of v3.95 (#282) 2026-04-26 12:39:27 +02:00
Enum CS update after release of v3.95 (#282) 2026-04-26 12:39:27 +02:00
Extension [Schema][Server] Add MCP Apps extension (io.modelcontextprotocol/ui) support (#281) 2026-06-01 09:35:54 +01:00
JsonRpc style: apply php-cs-fixer and PHPStan fixes (#289) 2026-04-20 20:49:15 +02:00
Request CS update after release of v3.95 (#282) 2026-04-26 12:39:27 +02:00
Result CS update after release of v3.95 (#282) 2026-04-26 12:39:27 +02:00
IconTest.php style: apply php-cs-fixer and PHPStan fixes (#289) 2026-04-20 20:49:15 +02:00
ImplementationTest.php [Schema] Fix Implementation::fromArray rejecting falsy-but-valid name/version (#393) 2026-07-14 23:41:51 +02:00
ResourceDefinitionTest.php [Server] Allow runtime-resolved element handlers (#294) 2026-05-29 07:16:12 +02:00
ResourceTemplateTest.php Add title field to Resource and ResourceTemplate (#301) 2026-05-17 14:10:31 +02:00
ServerCapabilitiesTest.php Split testsuite for unit and inspector based tests (#82) 2025-09-25 22:27:41 +01:00
ToolTest.php [Schema][Server] Add top-level title to Tool (#288) 2026-04-26 15:37:40 +02:00