|
14 | 14 | namespace Mcp\Tests\Server; |
15 | 15 |
|
16 | 16 | use Mcp\JsonRpc\MessageFactory; |
| 17 | +use Mcp\Schema\Notification\PromptListChangedNotification; |
| 18 | +use Mcp\Schema\Notification\ResourceListChangedNotification; |
| 19 | +use Mcp\Schema\Notification\ToolListChangedNotification; |
17 | 20 | use Mcp\Server\NotificationPublisher; |
18 | 21 | use PHPUnit\Framework\TestCase; |
19 | | -use Symfony\Contracts\EventDispatcher\Event; |
20 | 22 |
|
21 | 23 | /** |
22 | 24 | * @author Aggelos Bellos <[email protected]> |
23 | 25 | */ |
24 | 26 | class NotificationPublisherTest extends TestCase |
25 | 27 | { |
26 | | - public function testOnEventCreatesNotification(): void |
| 28 | + public function testEnqueue(): void |
27 | 29 | { |
28 | | - $expectedNotifications = []; |
| 30 | + $expectedNotifications = [ |
| 31 | + ToolListChangedNotification::class, |
| 32 | + ResourceListChangedNotification::class, |
| 33 | + PromptListChangedNotification::class, |
| 34 | + ]; |
29 | 35 | $notificationPublisher = new NotificationPublisher(MessageFactory::make()); |
30 | 36 |
|
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); |
36 | 39 | } |
37 | 40 |
|
38 | 41 | $flushedNotifications = $notificationPublisher->flush(); |
|
0 commit comments