News Feed
Sections




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

Giorgio Sironi's Blog:
Refactoring PHPUnit's getMock()
August 19, 2010 @ 10:49:16

Giorgio Sironi has a new post to his blog about a "refactoring" he's done of PHPUnit's mock objects to make their creation with getMock easier.

Not an actual refactoring, but at least the introduction of a layer of indirection, a Parameter object, called PHPUnit_Framework_MockSpecification. I have already written the patch in a branch of my github repository. They are actually two independent patches, since PHPUnit core and the mocking component are in two separate repositories.

If you create a basic object, the creation is simple, but when you start wanting to use one of the other optional parameters down the line, things can get messy. His solution adds methods like disableOriginalConstructor and disableAutoload to make this simpler. You can find the patches on his github account.

UPDATE: This feature has been included in the latest PHPUnit master branch.

0 comments voice your opinion now!
phpunit getmock patch builder designpattern


blog comments powered by Disqus

Similar Posts

Maarten Manders' Blog: Static + Unit Tests = Arrrghhh!

Shashikant Jagtap's Blog: PHPUnit + Behat/Mink + Page Object: The Rockstar Combination of Testing

PHPClasses.org: File upload progress meter for PHP 4, at last!

PHPBuilder.com: PHP and Adobe Air: Building a Time-tracking and Billing Application - Part II

Jani Hartikainen's Blog: Unit testing part 2: Writing and running tests


Community Events





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


update package laravel symfony tips community podcast language interview zendserver opinion install series library api deployment list release framework introduction

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