What unit testing in PHP to start [duplicate]

I’m really really baffled that Simpletest still is considered an alternative to phpunit. Maybe i’m just misinformed but as far as I’ve seen:

  • PHPUnit is the standard; most frameworks use it (like Zend Framework, Cake, Agavi, even Symfony is dropping their own Framework in Symfony 2 for phpunit).
  • PHPUnit is integrated in every PHP IDE (Eclipse, Netbeans, Zend Stuide, PHPStorm) and works nicely.
    • Simpletest has an eclipse extension for PHP 5.1 (a.k.a. so old that it’s on sourceforge) and nothing else.
  • PHPUnit works fine with every continious integration server since it outputs all standard log files for code coverage and test reports.
    • Simpletest does not. While this is not a big problem to start with it will bite you big time once you stop “just testing” and start developing software (Yes that statement is provocative 🙂 Don’t take it too seriously).
  • PHPUnit is activly mainted, stable and works great for every codebase, every scenario and every way you want to write your tests.
    • Simpletest is unmaintained, outdated and does not work well with PHP 5.3 (released over a year ago)
  • (Subjective) PHPUnit provides much nicer code coverage reports than Simpletest
    • With PHPUnit you also get these reports inside your IDE (Netbeans, Eclipse, …)

I’ve yet to see any argument in favor of Simpletest. It’s not even simpler to install since PHPUnit is available via pear:

pear channel-discover pear.phpunit.de
pear install phpunit/PHPUnit

and the “first test” looks pretty much the same.

For everything you want to test PHPUnit will have a solution and you will be able to find help pretty much anywhere (SO, #phpunit irc channel on freenode, pretty much every php developer 😉 )

Please correct me if i’ve stated something wrong or forgot something 🙂

Leave a Comment