Beispiel #1
0
 /**
  * Constructor.
  * 
  * @since  __DEPLOY_VERSION__
  */
 public function __construct()
 {
     // Get the command bus buidler.
     $commandBusBuilder = new CommandBusBuilder();
     // Build the command bus.
     $this->commandBus = $commandBusBuilder->getCommandBus();
 }
 /**
  * @param   Container  $container  The container
  *
  * @return  \Joomla\Service\CommandBus
  */
 public function createCommandBus(Container $container)
 {
     // Construct the command handler middleware
     $middleware = [];
     if ($container->has('CommandBusMiddleware')) {
         $middleware = (array) $container->get('CommandBusMiddleware');
     }
     if ($container->has('extension_factory')) {
         $middleware[] = new ExtensionQueryMiddleware($container->get('extension_factory'));
     }
     $builder = new CommandBusBuilder($container->get('EventDispatcher'));
     $middleware = array_merge($middleware, $builder->getMiddleware());
     $builder->setMiddleware($middleware);
     return $builder->getCommandBus();
 }
 public function setUp()
 {
     $dispatcher = new MockEventDispatcher();
     $commandBusBuilder = new CommandBusBuilder($dispatcher);
     $this->commandBus = $commandBusBuilder->setMiddleware(array_merge([new LoggingMiddleware(new Logger())], $commandBusBuilder->getMiddleware()))->getCommandBus();
 }