/**
  * @covers \PhpCqrs\Event\Publisher\LocatorEventPublisher::__construct
  * @covers \PhpCqrs\Event\Publisher\LocatorEventPublisher::publish
  */
 public function testCanDispatchCommand()
 {
     $locator = new InMemoryLocator();
     $listener = new BookPublishedEventListener();
     $locator->subscribe($listener, 'BookPublished');
     $publisher = new LocatorEventPublisher($locator);
     $payload = new BookPublished('1234');
     $message = GenericDomainEventMessage::forPayload('1', 1, $payload);
     $publisher->publish($message);
     $this->assertSame($payload, $listener->handled());
 }
 /**
  * @covers \PhpCqrs\Event\Listener\Locator\InMemoryLocator::locate
  */
 public function testCanNotLocateEventListener()
 {
     $locator = new InMemoryLocator();
     $message = GenericDomainEventMessage::forPayload('1', 1, new BookPublished('1234'));
     $this->assertSame([], $locator->locate($message));
 }