The CMB Test Suite uses PHPUnit to help us maintain the best possible code quality.
The master branch of CMB is automatically tested on travis-ci.org. The image above will show you the latest test's output. Travis-CI will also automatically test all new Pull Requests to make sure they will not break our build.
git clone [email protected]:CMB2/CMB2.git ./
This might be tricky. We recommend using homebrew because it lets you install lots of things very easily.
If you use homebrew, you can just run brew install phpunit
.
If you haven't already installed the WordPress testing library, we have a helpful script to do so for you.
Note: you'll need to already have svn
, wget
, and mysql
available.
Change to the CMB directory:
cd CMB2
bash tests/bin/install-wp-tests.sh wordpress_test root '' localhost latest
wordpress_test
is the name of the test database (all data will be deleted!)root
is the MySQL user name''
is the MySQL user passwordlocalhost
is the MySQL server hostlatest
is the WordPress version; could also be3.7
,3.6.2
etc.
Note: MySQL must be running in order for tests to run.
phpunit
All you need to do is run these two commands, and then prior to accepting any commit grunt will run phpunit. If a test fails, the commit will be rejected, giving you the opportunity to fix the problem first.
npm install
grunt githooks
Note: You'll need to install npm if that's not available. You could also install this via homebrew using brew install npm
.