Automated Code Coverage of WordPress Core PHP code

Scott Taylor offered me “$3-4 million” to set up automated code coverage for WordPress core. While it is a bit below my usual hourly rate, I decided to give Scott a 🎁to celebrate WordPress 4.4 Beta 1 and did it for free. Running codecov as a part of the normal travis-ci runs wasn’t really an option since it can take an hour to do the phpunit run with codecoverage turned on and the builds are long enough as is, so I decided to setup a new script with a new travis config. This new config is largely a cutdown version of the current travis config combined with running phpunit with code coverage turned on.  An hourly cron checks to see if there have been any commits and if so, replaces the travis.yml file with the code coverage version and pushes that to github.  The two files are below.

Overall, it was a quick hacky way to hopefully help WordPress core contributors get a better sense of where unit tests are needed.  You can see the results for yourself. 

Leave a Reply

Your email address will not be published. Required fields are marked *