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

Allow unit test DB config to be supplied via environment vars #846

Merged

Conversation

westonruter
Copy link
Contributor

Based on our conversation here: https://twitter.com/jeremyfelt/status/707751217187819521

With this in place, you'd be able to brew install mysql, create the wordpress_unit_tests database:

CREATE DATABASE IF NOT EXISTS wordpress_unit_tests CHARACTER SET utf8;

And then add the following lines to your host machine's .bash_profile:

export WP_TESTS_DB_HOST=localhost
export WP_TESTS_DB_NAME=wordpress_unit_tests
export WP_TESTS_DB_USER=root
export WP_TESTS_DB_PASSWORD=''

Assuming you also have PHPUnit installed (brew install phpunit), you show now be able to run phpunit from a terminal on the host machine and execute the unit tests as fast as possible.

@westonruter
Copy link
Contributor Author

@jeremyfelt in my testing, I found that running the entire test suite inside vagrant took around 3 minutes, whereas running the test suite completely from host machine took 2.5 minutes. Does this difference in performance align with what you've seen?

@jeremyfelt
Copy link
Member

@westonruter Hmm. I think the WP core tests have gotten quite a bit quicker. The last time I ran them inside the VM, it took ~8 minutes while my local environment was around 3 minutes. Just now though, the VM tests took less than 2 minutes. I think I might be going crazy.

@westonruter
Copy link
Contributor Author

I just published a writeup comparing running PHPUnit entirely in the VM, PHP on host but DB in VM, and then entirely on host without VM at all: https://make.xwp.co/2016/03/10/running-phpunit-tests-outside-vvv/

@jeremyfelt jeremyfelt added this to the Next Release milestone Mar 31, 2016
@jeremyfelt jeremyfelt merged commit 34a9cce into Varying-Vagrant-Vagrants:develop Mar 31, 2016
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

2 participants