
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.
I co-organize PHP-WVL and currently work for Combell (based in Ghent), so after some chatting with the folks of Ghent PHP, we agreed to join forces and organize this years edition back at Combell.
#PHP TestFest van @phpwvl & @phpgent β‘ Help mee de kwaliteit van de PHP source code te verbeteren π 20 nov: https://t.co/NbODMr0QTl π 27 nov: https://t.co/5n5AkY0oaB pic.twitter.com/FtcOKS5g1Z
β 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.
I started by listening to PHP Roundtable episode 65 in the car, to get up to speed. Next up: the PHP TestFest websiteΒ and the excellent video series of Sammy.
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.
Our contribution.
After 2 weeks, we managed to submit 13 pull requests, where most were approved!
The majority of our @phptestfest Pull Requests were approved today! @phpwvl @phpgent https://t.co/OXMum64Mn3 pic.twitter.com/8Qc3tHoeGz
β Jachim Coudenys (@coudenysj) 11 december 2017
Kicking off @phptestfest pic.twitter.com/RnNm0bV287
β Ghent PHP Meetup (@phpgent) 20 november 2017
Maar eerst: eten. Bedankt @combell! pic.twitter.com/TwyOOqKDbY
β PHP-WVL (@phpwvl) 20 november 2017
Finding uncovered PHP lines isn’t that easy! #phptestfest pic.twitter.com/Y9x06o2mWQ
β Jachim Coudenys (@coudenysj) 20 november 2017
Monday @phptestfest-day! pic.twitter.com/pVd9ThIwx8
β Ghent PHP Meetup (@phpgent) 27 november 2017
Resources