Test Command is Showing in Build Output
manuth opened this issue · comments
The test
command is showing in the build command despite the fact of the TestCommand
being listed as a $developmentOnlyCommands
:
https://github.com/laravel-zero/framework/blob/e9bdb5e1338c4c874be9cb6c902c5fbc5a58e02e/src/Kernel.php#L50-L52
Thus, I don't think this is intended.
Probably related to #401
Inspired by the workaround presented in #401, I found myself able to work around this issue by adding the following snippet to my AppServiceProvider
's boot
-method:
use Illuminate\Support\Facades\Artisan;
use NunoMaduro\Collision\Adapters\Laravel\Commands\TestCommand;
use Symfony\Component\Console\Command\Command;
// [...]
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
if ($this->app->environment("production")) {
collect(Artisan::all())->each(function (Command $command) {
if ($command instanceof TestCommand) {
$command->setHidden();
}
});
}
}
Looks like a good workaround! Thanks for sharing.
Closed in favor of #408
Sorry for the confusion
@caendesilva you might want to look at my new suggested workaround in #408.
Though, it's a little more verbose, but it stays the most true to the way laravel-zero
works.
Calling Artisan::all()
in the boot()
-method causes all other ServiceProviders
to inject their commands incorrectly.
This isn't the case in my new workaround.
Hope this helps 😄