News Feed
Sections




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

SitePoint.com:
Advanced PHPUnit Testing Annotations and Mocking
February 17, 2011 @ 09:33:08

On SitePoint.com today there's a new article in their unit testing series posted today - a look at annotations and mocking in advanced unit testing with PHPUnit. (Disclaimer: I am the author of this article series.)

PHPUnit has lots of advanced features that can be amazingly helpful when that special case comes around. This includes extending the framework itself, making test suites, building static datasets, and the focus of this article: annotations and mocking. Don't worry if you're unsure what either of these are; I'm here to help. I trust by the end that you'll see how these two features can be useful to both you and your tests.

The article starts with annotations showing how they can be used both on the class side to help with test generation and on the test side to help in evaluation (like expectedException). In the mocking section, it shows you how create simple and complex mock objects to replace a sample database query.

0 comments voice your opinion now!
tutorial unittest annotation mocking phpunit testing


blog comments powered by Disqus

Similar Posts

Gary Hokin: An Introduction to Zend Framework 2 for the Zend Framework 1 Developer - Part 1

Anthony Wlodarski's Blog: Node.js and Zend Auth with Sessions stored in the database

Volker Dusch's Blog: Creating your custom PHPUnit output formats

David Para's Blog: Writing a simple PHP sourcecode buildscript in Scala

PHPMaster.com: The Liskov Substitution Principle


Community Events





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


language bugfix community series deployment code interview symfony tips conference podcast release api framework threedevsandamaybe voicesoftheelephpant laravel zendserver list introduction

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