Skip to content

Commit 4336e14

Browse files
committed
add a small test
1 parent 0751310 commit 4336e14

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
}

0 commit comments

Comments
 (0)