@sturm Why not just use original command with the argument? Why do you need to create a “wrapping” command?
Custom Artisan Command Not Acknowledging Argument
I'm attempting to create a custom artisan command that calls another artisan command with specific arguments. However, it is ignoring one of the arguments.
public function handle(): void
{
$this->call('test', ['--compact' => true, '--exclude-testsuite' => 'Integration']);
}
This does call artisan test with the --compact switch, but it does not exclude the Integration test suite.
Calling sail artisan test --compact --exclude-testsuite=Integration does work just fine, so why is it ignoring that argument when I'm calling it from my custom command? Do I have the syntax wrong or something?
After spending far too much time on trying to move our Lando tooling over to Artisan, I've decided that probably the best approach is to use shell aliases. So I'll put these in our repo's README and recommend that our developers put this in there .bashrc, .zshrc, .aliases, or whatever file they prefer, as long as it is sourced upon login.
# Development Aliases
alias lint='[ -f ./vendor/bin/duster ] && ./vendor/bin/duster lint'
alias lint-fix='[ -f ./vendor/bin/duster ] && ./vendor/bin/duster fix'
alias testcov='[ -f sail ] && sail artisan test --compact --exclude-testsuite=Integratio>
alias test='[ -f sail ] && sail artisan test --compact --no-coverage --exclude-testsuite>
alias testint='[ -f sail ] && sail artisan test --compact --testsuite=Integration'
alias stan='[ -f ./vendor/bin/phpstan ] && ./vendor/bin/phpstan analyze'
alias precommit='lint-fix && lint && stan && testcov'
Please or to participate in this conversation.