예제 #1
0
 public function testDispatchShouldCallAfterResolvingIfCommandNotQueued()
 {
     $container = new Container();
     $handler = m::mock('StdClass')->shouldIgnoreMissing();
     $handler->shouldReceive('after')->once();
     $container->instance('Handler', $handler);
     $dispatcher = new Dispatcher($container);
     $dispatcher->mapUsing(function () {
         return 'Handler@handle';
     });
     $dispatcher->dispatch(new BusDispatcherTestBasicCommand(), function ($handler) {
         $handler->after();
     });
 }
 /**
  * Dispatch a command to its appropriate handler.
  *
  * @param mixed $command
  * @param \Closure|null $afterResolving
  * @return mixed 
  * @static 
  */
 public static function dispatch($command, $afterResolving = null)
 {
     return \Collective\Bus\Dispatcher::dispatch($command, $afterResolving);
 }