File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
tests/Unit/Server/Session Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the official PHP MCP SDK.
5+ *
6+ * A collaboration between Symfony and the PHP Foundation.
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace Mcp \Tests \Unit \Server \Session ;
13+
14+ use Mcp \Server \Session \InMemorySessionStore ;
15+ use Mcp \Server \Session \Session ;
16+ use PHPUnit \Framework \TestCase ;
17+
18+ class SessionTest extends TestCase
19+ {
20+ public function testAll ()
21+ {
22+ $ store = $ this ->getMockBuilder (InMemorySessionStore::class)
23+ ->disableOriginalConstructor ()
24+ ->onlyMethods (['read ' ])
25+ ->getMock ();
26+ $ store ->expects ($ this ->once ())->method ('read ' )->willReturn (json_encode (['foo ' => 'bar ' ]));
27+
28+ $ session = new Session ($ store );
29+ $ result = $ session ->all ();
30+ $ this ->assertEquals (['foo ' => 'bar ' ], $ result );
31+
32+ // Call again to make sure we dont read from Store
33+ $ result = $ session ->all ();
34+ $ this ->assertEquals (['foo ' => 'bar ' ], $ result );
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments