Hey All,
UPHPU had a successful PHP TestFest meetup last night. Here are some of my notes from the meetup.
- I made sure I had a fully working environment and posted my PR prior to the meetup, which freed me up to help others and helped me know what to do. I was also able to run lcov for others who had setup issues to confirm their tests covered what they expected.
- The hardest thing was to find areas needing tests added. Using
http://gcov.php.net/PHP_7_1/lcov_html/ was very helpful, and searching the c files for 'php_function(' helped find function definitions and identify where tests were missing.
- We had people with different expertise who helped others out. For example, those who regularly contributed to open source projects helped others interacting with the github repos and creating pull requests. This was really helpful and made things go much smoother.
- We used a slack channel during the meetup to pass around commands, urls, etc., which turned out to be very useful.
- Make sure 'make' and other commands complete successfully when setting up or else things won't work
At the bottom of this email are my command notes. Using
https://puphpet.com/ to build a very basic Ubuntu VM, and with VirtualBox and Vagrant already installed, I was able to use these commands to get attendees up and running quickly, which saved an immense amount of time during the meetup. Others in our group used Docker similar to what Clinton emailed a how-to earlier about. Our meetup ran for a bit over 2 hours, but people were still working on things (either lingered longer or went home) for a couple of extra hours.
Thanks Ben, Sammy, and others who helped organize this event and put time and resources into doing the prep work!
Mark Niebergall
UPHPU President
------------------------
Notes
------------------------
Helpful URLs:
------------------------
After unzipping a puphpet file for a basic Ubuntu VM, run this from terminal:
vagrant ssh
sudo apt-get update
cd /var/www/html
cd php-src
sudo apt-get install autoconf -y
./buildconf
sudo apt-get install libxml2-dev -y
sudo apt-get install valgrind -y
sudo apt-get install lcov -y
./configure --enable-maintainer-zts --enable-debug --enable-cli-sapi --enable-gcov
make
------------------------
Running tests with either:
- sapi/cli/php run-tests.php -P path/to/test/some_function001.phpt
or better
- make test TESTS="--show-out path/to/test/some_function001.phpt"
------------------------
Running lcov to verify tests cover lines expected:
make clean
make
make lcov TESTS=path/to/test/some_function001.phpt
You can just run the "make lcov TESTS=..." for new tests instead of "make clean" and "make" multiple times. This generates html files locally at lcov_html/ and then open the index.html page in a browser.
------------------------
Creating a PR on Github (after setting up ssh keys):
2. Fork the repo, choose your account
3. git remote set-url origin g...@github.com:mbniebergall/phptestfest-php-src.git
4. git remote add upstream g...@github.com:phpcommunity/phptestfest-php-src.git
5. git checkout master
6. git checkout -b test-some_function_error
7. git add path/to/test/some_function001.phpt
8. git commit -m "Add test for some_function for some error"
9. git push origin test-some_function_error
11. Click "Compare & Pull Request" button
12. Add a description, including what lines did not have tests and the user group the tests are from
13. Create the pull request
Hope that helps!