Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behat: Allow test DB user + pass to be set by env vars #4196

Merged

Conversation

aaemnnosttv
Copy link
Contributor

This is something that I added for the valet command because I needed to be able to test creation and deletion of databases other than wp_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 with WP_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

self::$db_settings['dbuser'] = getenv( 'WP_CLI_TEST_DBUSER' );
}

if ( getenv( 'WP_CLI_TEST_DBPASS' ) !== false ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the (unnatural, hard to read & pointless) "yoda" style here to conform to WPCS?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right. That xD

@gitlost
Copy link
Contributor

gitlost commented Jul 4, 2017

Thanks @aaemnnosttv!

@danielbachhuber danielbachhuber added this to the 1.3.0 milestone Jul 4, 2017
@gitlost gitlost merged commit 3cc957c into wp-cli:master Jul 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants