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

Sebastian Bergmann's Blog:
Mock Objects in PHPUnit
Jul 05, 2005 @ 11:17:07

Sebastian Bergmann has more information over on his blog today about the creation of Mock Objects in PHPUnit (a popular unit testing framework).

While I am preparing the PHPUNIT_2_3 CVS branch for a release of PHPUnit 2.3.0 alongside PHP 5.1.0, I recently started working on support for Mock Objects in PHPUnit.

Suppose you have the following class Foo: You can now write a test case that checks whether or not the bar() gets called on an object of the Foo class.

This feature can come in quite handy when testing your site, especially if you want to ensure that a specific "stubbed-out" object/method always runs.

tagged:

Link:


Trending Topics: