Skip to content

Commit

Permalink
Do not run commands when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Apr 4, 2024
1 parent ffdb4b8 commit 76f1bdd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/HorizonServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 76f1bdd

Please sign in to comment.