/** @test */
 public function canResolveStaticly()
 {
     $command = $this->getMock(AbstractCommand::class);
     $handler = $this->getMock(AbstractHandler::class);
     $resolver = new StaticHandlerResolver();
     $resolver->add(get_class($command), get_class($handler));
     $resolved = $resolver->getHandlerClassName($command);
     $this->assertEquals(get_class($handler), $resolved);
 }
 /** @test */
 public function willEmitEventsIfTriggeredInHandler()
 {
     $command = $this->getMockBuilder(AbstractCommand::class)->getMock();
     $handler = $this->getMockBuilder(AbstractHandler::class)->getMock();
     $handler->method('handle')->willReturn(PayloadFactory::createSuccessPayload(['data' => 'value']));
     $handler->method('getEventsTriggered')->willReturn([['event' => new Event('name'), 'params' => []]]);
     $resolver = new StaticHandlerResolver();
     $resolver->add(get_class($command), get_class($handler));
     $events = $this->getMockBuilder(Emitter::class)->getMock();
     $events->expects($this->once())->method('emit');
     $container = $this->getMockBuilder(ContainerInterface::class)->getMock();
     $container->method('has')->willReturn(true);
     $container->method('get')->willReturn($handler);
     $bus = new Bus([$resolver], $events, $container);
     $result = $bus->execute($command);
 }