PHPUnit is a framework independent library for unit testing PHP. Unit testing is a method by which small units of code are tested against expected results. Traditional testing tests an app as a whole meaning that individual components rarely get tested alone.
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks. The currently supported versions are PHPUnit 9 and PHPUnit 8.
#3) PHPUnitIt is an open source testing tool used for PHP code. It is the most widely used framework for unit testing.
This question is quite dated but as it is still getting traffic and answers I though I state my point here again even so I already did it on some other (newer) questions.
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:
web interface to phpunit tests
.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.
As of PHPUnit 3.7
it's even easier to install it by just using the PHAR Archive
wget http://pear.phpunit.de/get/phpunit.phar
chmod +x phpunit-3.7.6.phar
or for windows just downloading the phar and running:
php phpunit-.phar
or when using the supported composer install ways like
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
to your composer.json.
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 :)
Video: http://conference.phpnw.org.uk/phpnw11/schedule/sebastian-bergmann/
Slides: http://www.slideshare.net/sebastian_bergmann/the-php-testers-toolbox-osi-days-2011
It mentions stuff like Atoum which calls its self: "A simple, modern and intuitive unit testing framework for PHP!"
I've originally written this answer Jan. 2011 where I had no affiliation with any PHP Testing project. Since then I became a contributor to PHPUnit.
I prefer PHPUnit now, but when I started out I used SimpleTest as I didn't always have access to the command line. SimpleTest is nice, but the only thing it really has over PHPUnit, in my opinion, is the web runner.
The reasons I like PHPUnit are that it integrates with other PHP developer tools such as phing (as does SimpleTest), phpUnderControl, and Xinc. As of version 3.0 it has mocking support, is being actively developed, and the documentation is excellent.
Really the only way to answer this question for yourself is to try both out for a time, and see which fits your style better.
EDIT: Phing now integrates with SimpleTest as well.
I could, however, easily understand how to install SimpleTest.
(As far as i can remember the instructions for PHPUnit said something along the lines of "install it via PEAR and we won't give any instructions on how to do it any other way") see:
For SimpleTest, just download it and point to it from your code.
So Simpletest won for me.
Half of the mentioned points in the accepted answer are simply not true:
SimpleTest has
The downside:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With