News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
Raphael Stolt's Blog:
Creating custom PHPUnit assertions
July 29, 2008 @ 10:25:15

Raphael Stolt has written up a post for his blog talking about custom PHPUnit assertions and a simple method to create them.

In this blog post I'd like to set the focus on some of the aspects of the Custom Assertion pattern, by showing how to create custom PHPUnit assertions, which attacks the above mentioned smell [of bad test code] and its retroactive effects with a huge antiperspirant flagon, while also providing the chance to build a customer friendly and domain related test vocabulary.

His first assertion is simple, checking the contents of a bag object to be sure that there are no duplicate items and that its content count is reduced by one if something is removed. Then, he moves on to making the custom assertion for his "IdShouldFollowAgreedConvention" test. He explains how to use the assertion class and how it all fits together in the final, functional test case.

0 comments voice your opinion now!
custom phpunit assertion unittest customassertion pattern



Similar Posts

Stefan Mischook's Blog: Creating Custom PHP Functions Video Tutorial - Part 3

Chris Hartjes' Blog: A New Way Of Judging Frameworks: Where are the tests?

Tony Bibbs' Blog: Book Review: Pro PHP

Sebastian Bergmann's Blog: RC2 Is The New RC1 (PHPUnit)

Jani Hartikainen's Blog: Complex custom elements in Zend_Form


Community Events









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


mysql developer book release PEAR cakephp zend job security releases ajax package application code framework database conference PHP5 zendframework example

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