News Feed
Sections




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

NetTuts.com:
All About Mocking with PHPUnit
September 28, 2012 @ 09:46:21

NetTuts.com has another post for those out there wanting to further their PHP unit testing knowledge. In this new tutorial, Csaba Patkos introduces you to mocking objects with PHP Unit - a powerful method to help test some of the more difficult things.

There are two styles of testing: "black box" and "white box" styles. Black box testing focuses on the object's state; whereas, white box testing focuses on behavior. The two styles complement each other and can be combined to thoroughly test code. Mocking allows us to test behavior, and this tutorial combines the mocking concept with TDD to build an example class that uses several other components to achieve its goal.

He illustrates mocking with his sample "toy car" application and shows how to use a few different types of mocks (test doubles) to create some tests. These types include dummy objects, test stubs, test mocks and test fakes. Code is included for all test examples, including some showing the use of the actual PHPUnit mocking functionality.

0 comments voice your opinion now!
mocking phpunit tutorial doubles unittest


blog comments powered by Disqus

Similar Posts

Grzegorz Godlewski's Blog: Automating software development and deployment

Juozas Kaziukenas' Blog: Zend Framework and Doctrine. Part 2

Sebastian Bergmann's Blog: AJAX-Based Test Runner for PHPUnit

NetTuts.com: Creating a Photo Tag Wall With Twilio Picture Messaging & PHP

IBM developerWorks: What's new in PHP V5.2, Part 4: Using the new ZIP extension


Community Events





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


configure developer api wordpress project series list application code language library threedevsandamaybe release podcast laravel community introduction framework interview bugfix

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