Behat: Allow test DB user + pass to be set by env vars #4196
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.
This is something that I added for the
valet
command because I needed to be able to test creation and deletion of databases other thanwp_cli_test
. Rather than granting more permissions, I felt it would be much easier to just use different credentials. I think this could be useful in other situations as well.In case you're wondering the
!== false
check on the password var is to allow for an empty password to be set withWP_CLI_TEST_DBPASS=""
, where the others cannot be empty.E.g. https://github.com/aaemnnosttv/wp-cli-valet-command/blob/af1ee1123c3d2fa991a5d4a6ba982db14b966397/.travis.yml#L8-L11