createMock(NotifierInterface::class); $mockSlack->expects($this->once()) ->method('send') ->willReturn(true); $mockDiscord = $this->createMock(NotifierInterface::class); $mockDiscord->expects($this->once()) ->method('send') ->willReturn(true); $dispatcher->addNotifier('slack', $mockSlack); $dispatcher->addNotifier('discord', $mockDiscord); $this->assertTrue($dispatcher->hasNotifiers()); $payload = new NotificationPayload('https://example.com', 95, 2, 0, 2); $results = $dispatcher->dispatch($payload); $this->assertTrue($results['slack']); $this->assertTrue($results['discord']); } }