News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Philip Norton's Blog:
PHPUnit Skeleton Classes
July 25, 2011 @ 10:34:01

In this new post to his blog, Philip Norton reminds you about a handy feature of PHPUnit, the popular PHP unit testing tool, that can make generating tests for your application simpler - the skeleton class generator.

If you create classes in PHP then you should be unit testing them as much as you can. Setting up unit testing classes for your code can be time consuming and involve a bunch of copying and pasting. Thankfully, PHPUnit comes with a couple of helper functions that allow the creation of unit testing classes automatically, which can save a bit of copying and pasting.

He includes an example of a class named "Spider" and shows both the contents of the class and the resulting test that comes from running "phpunit --skeleton-test" on it. The resulting test has methods for each method in your class and marks them all as incomplete. As Philip notes, this is a good start but should never be relied upon as a test to leave as-is.

0 comments voice your opinion now!
phpunit skeleton class unittest generate


blog comments powered by Disqus

Similar Posts

Jachim Coudenys: Using multiple databases in phpunit/dbunit with Composer

DevShed: Simulating Events with PHP 5

Zumba Engineering Blog: Incorporating Mongounit into Multi-datasource Models with Traits

Builder.com: Get the correct time by converting between time zones with PHP and PEAR

Greg Beaver's Blog: Pyrus, PEAR2 and web code coverage report for phpt-based tests


Community Events





Don't see your event here?
Let us know!


threedevsandamaybe interview developer series community zendserver podcast opinion bugfix introduction laravel release library framework tips symfony api deployment list language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework