File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1111
1212namespace Mcp \Tests \JsonRpc ;
1313
14+ use Mcp \Exception \InvalidArgumentException ;
1415use Mcp \Exception \InvalidInputMessageException ;
1516use Mcp \JsonRpc \MessageFactory ;
1617use Mcp \Schema \Notification \CancelledNotification ;
1718use Mcp \Schema \Notification \InitializedNotification ;
19+ use Mcp \Schema \Notification \ResourceListChangedNotification ;
1820use Mcp \Schema \Request \GetPromptRequest ;
1921use PHPUnit \Framework \TestCase ;
2022
@@ -81,6 +83,22 @@ public function testBatchMissingMethod()
8183 $ this ->assertInstanceOf (InitializedNotification::class, $ result );
8284 }
8385
86+ public function testCreateByType (): void
87+ {
88+ $ result = $ this ->factory ->createByType (InitializedNotification::class, []);
89+ $ this ->assertInstanceOf (InitializedNotification::class, $ result );
90+ }
91+
92+ public function testCreateByTypeWithMissingData (): void
93+ {
94+ $ this ->expectException (InvalidArgumentException::class);
95+ $ this ->expectExceptionMessage (
96+ 'Invalid or missing "requestId" parameter for "notifications/cancelled" notification. '
97+ );
98+
99+ $ this ->factory ->createByType (CancelledNotification::class, []);
100+ }
101+
84102 /**
85103 * @param iterable<mixed> $items
86104 */
You can’t perform that action at this time.
0 commit comments