diff --git a/src/HorizonServiceProvider.php b/src/HorizonServiceProvider.php index 6d2e50c2..bf8e63e2 100644 --- a/src/HorizonServiceProvider.php +++ b/src/HorizonServiceProvider.php @@ -112,7 +112,7 @@ protected function offerPublishing() */ protected function registerCommands() { - if ($this->app->runningInConsole()) { + if ($this->app->runningInConsole() && ! $this->app->runningUnitTests()) { $this->commands([ Console\ClearCommand::class, Console\ClearMetricsCommand::class, @@ -149,9 +149,11 @@ public function register() define('HORIZON_PATH', realpath(__DIR__.'/../')); } - $this->app->bind(Console\WorkCommand::class, function ($app) { - return new Console\WorkCommand($app['queue.worker'], $app['cache.store']); - }); + if ($this->app->runningInConsole() && ! $this->app->runningUnitTests()) { + $this->app->bind(Console\WorkCommand::class, function ($app) { + return new Console\WorkCommand($app['queue.worker'], $app['cache.store']); + }); + } $this->configure(); $this->registerServices();