It’s Wednesday 7/6/2017 and Ben Ramsey emails the UG-ADMIN mailinglist with the subject “PHP TestFest 2017”. I instantaneously think about the 2009 edition which I attended (at Combell, organized by PHPBelgium).
I had a great time during that edition (I even managed to get some test code into PHP source) and was wondering if we could join this years edition with a couple of local user groups.
— Combell (@combell) 9 november 2017
As the date we’d picked came closer, I had to figure out how to test the code and get them into PHP Source these days, so I could “mentor” the visitors. I still remembered how to write phpt files, but had to figure out the rest of the flow.
For specific questions, the mailing list is perfect, which helped me with some questions about code coverage.
I figured out there is a fork of the PHP source where all pull requests with tests should be created: https://github.com/phpcommunity/phptestfest-php-src/pulls.
Figuring out what to test.
To find code that needs testing, you have a couple of options:
- You can improve code coverage (by looking at http://gcov.php.net/PHP_HEAD/lcov_html/);
- You can prove bugs (https://bugs.php.net/);
- Or you can fix failing test.
When you look for uncovered code on the gcov site, there are some things you need to take into account:
- It is possible that the gcov server does not have all PHP modules loaded (making it appear lots of code fragments are uncovered), see — SKIPIF —;
- Some tests use “exec” or “popen”, making it “untrackable” for the coverage tool (the cli_server test appear to be uncovered for this reason);
- Not all testfest tests have been merged.
To solve the last problem, I created a fork of the phptestfest fork, where I merged all the approved pull requests in a branch. This way, I can render code coverage for a specific path, including all the phptestfest tests from other users.
After 2 weeks, we managed to submit 13 pull requests, where most were approved!
— Jachim Coudenys (@coudenysj) 11 december 2017
— Ghent PHP Meetup (@phpgent) 20 november 2017
— PHP-WVL (@phpwvl) 20 november 2017
— Jachim Coudenys (@coudenysj) 20 november 2017
— Ghent PHP Meetup (@phpgent) 27 november 2017