In looking at PHPUnit as an option to add some unit testing to a large, spaghettified legacy application, I'm finding it annoyingly difficult to figure out how to get it to work with our home-built framework. Therefore I'm wondering if any of you have any thoughts on alternative unit test tools that maybe are simpler and/or more flexible. I'm more interested in the ability to add basic unit tests with minimal pain than I am with lots of features and fancy reporting.
PHP Unit Testing Recommendations
PS: The app currently uses PHP 5.3.9 ( ), which puts a further limit on what can be used.
The version constraint limits suggestions certainly (bye-bye Codeception, bye-bye Kahlan). If you want to get really basic, I can imagine going right back to PHP's own test framework. You'll have a 5.3.9 version of the distribution. Write a pile of .phpt
files and run run-tests.php
on the directory.
https://qa.php.net/write-test.php
https://qa.php.net/running-tests.php
I may start with more of an integration-level test, as the application's custom framework provides a way to run API calls from a CLI syntax, making it somewhat easy to set up tests that emulate web requests without actually having to bother with HTTP, etc. Since the majority of the app consists of API calls with JSON responses, I figure the 80/20 rule will likely apply as far as covering a good chunk of the functionality.
Next up, making the PHP version upgrade a priority -- for which that test suite would be nice to have.