News Feed
Sections




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

Web Builder Zone:
PHPUnit 3.5 easier asserting and mocking
September 28, 2010 @ 08:46:55

On the Web Builder Zone (part of DZone) Giorgio Sironi has a new article talking about new features in the latest release of PHPUnit including one of his own introduction - the MockBuilder to make mocking in tests simpler.

The official release of PHPUnit 3.5 is now available for PEAR installation, after a long beta period. PHPUnit 3.5 provides many new features such as a bunch of new assertions methods and annotations, and a little but very useful contribution of mine: the MockBuilder. [...] As you may know, the 3.4 Api contains a getMock() method with 7 arguments. Since some of this arguments are booleans, a call to getMock() can get very obscure if you don't memorize the meaning of all the 7 arguments. [...] The Builder creational pattern is a small layer of abstraction over the instantation process, that [...] gives you a clear Api.

He includes a few examples of both the "getMock" function call and its "getMockBuilder" relation. He also includes a full sample class that shows off some of the other new improvements to PHPUnit like new assertions on variables and object attributes, the "instanceof" checks and the MockBuilder once again.

0 comments voice your opinion now!
assert unittest phpunit mockbuilder mock


blog comments powered by Disqus

Similar Posts

PHP Town Hall Podcast: Episode #3 - The EE Revolt of 2012 and Why You Should Unit-test Your Shit

Court Ewing's Blog: How PHP is Broken and How It Can Be Fixed

Chris Hartjes: The Grumpy Programmer's PHPUnit Cookbook

The PHP.cc Blog: PHPUnit 4.0: Test Proxies

Lars Tesmer's Blog: What My Co-Workers and I Learned When Trying to Write Unit Tests for PHPUnit


Community Events

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


interview language threedevsandamaybe voicesoftheelephpant podcast library opinion api introduction symfony version framework laravel5 series extension security laravel community release unittest

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