Skip to content

Commit d4f5626

Browse files
committed
Update tests
1 parent c727546 commit d4f5626

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

tests/JsonRpc/MessageFactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Mcp\JsonRpc\MessageFactory;
1717
use Mcp\Schema\Notification\CancelledNotification;
1818
use Mcp\Schema\Notification\InitializedNotification;
19-
use Mcp\Schema\Notification\ResourceListChangedNotification;
2019
use Mcp\Schema\Request\GetPromptRequest;
2120
use PHPUnit\Framework\TestCase;
2221

tests/Server/NotificationPublisherTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,28 @@
1414
namespace Mcp\Tests\Server;
1515

1616
use Mcp\JsonRpc\MessageFactory;
17+
use Mcp\Schema\Notification\PromptListChangedNotification;
18+
use Mcp\Schema\Notification\ResourceListChangedNotification;
19+
use Mcp\Schema\Notification\ToolListChangedNotification;
1720
use Mcp\Server\NotificationPublisher;
1821
use PHPUnit\Framework\TestCase;
19-
use Symfony\Contracts\EventDispatcher\Event;
2022

2123
/**
2224
* @author Aggelos Bellos <[email protected]>
2325
*/
2426
class NotificationPublisherTest extends TestCase
2527
{
26-
public function testOnEventCreatesNotification(): void
28+
public function testEnqueue(): void
2729
{
28-
$expectedNotifications = [];
30+
$expectedNotifications = [
31+
ToolListChangedNotification::class,
32+
ResourceListChangedNotification::class,
33+
PromptListChangedNotification::class,
34+
];
2935
$notificationPublisher = new NotificationPublisher(MessageFactory::make());
3036

31-
foreach (NotificationPublisher::EVENTS_TO_NOTIFICATIONS as $eventClass => $notificationClass) {
32-
/** @var Event $event */
33-
$event = new $eventClass();
34-
$notificationPublisher->enqueue($event);
35-
$expectedNotifications[] = $notificationClass;
37+
foreach ($expectedNotifications as $notificationType) {
38+
$notificationPublisher->enqueue($notificationType);
3639
}
3740

3841
$flushedNotifications = $notificationPublisher->flush();

0 commit comments

Comments
 (0)