Fix issue where order of CLI arguments matters #334
+14
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @nunomaduro ,
Thanks for maintaining this project! Hopefully I have explained my change in enough detail below but please let me know if it needs further explanation or changes.
The TestCommand uses ignoreValidationErrors to allow it to accept and pass through arbitrary options to phpunit/paratest. For example it does not define
--stop-on-errorbut can pass it through to phpunit.A side effect of this is that the order of options matters, e.g.
php artisan test -p --recreate-databases --stop-on-errordoes recreate databases, whilephp artisan test -p --stop-on-error --recreate-databasesdoes not.This appears to be because when the validator hits an option it does not know about, it stops processing and any subsequent options cannot be resolved via $this->option.
It looks like this was previously handled when passing through options to phpunit/paratest but was not handled when setting environment variables, this change fixes that.