News Feed
Jobs Feed
Sections




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

Robert Basic:
Unit testing Zend Framework 2 modules
September 17, 2012 @ 11:22:33

Robert Basic has a new post showing you how to create unit tests for modules in your Zend Framework 2 applications. His example includes how to set up PHPUnit and how to write a few sample tests.

Porting this blog to Zend Framework 2, I decided to write some unit tests as well, while I'm at it. Not that the current code base doesn't have unit tests, just it doesn't have much of it... Anyway, I'd like to show how to get unit tests for modules up and running, as well how to throw in Mockery in the mix, as it can help us greatly with mocking out objects.

He includes the sample "phpunit.xml" configuration file contents, a "bootstrap.php" file to correctly initialize all the resources you'll need (including Mockery) and two kinds of tests - one on the service layer and another on the database layer.

0 comments voice your opinion now!
zendframework2 modules unittest phpunit tutorial


blog comments powered by Disqus

Similar Posts

John Conde's Blog: Handling Online Payments With PHP And Authorize.Net

Wojciech Sznapka's Blog: Why Mockery is better than PHPUnit Mock Builder (with Symfony2)

Content with Style: Zend Framework with nginx and php-fastcgi

DashExamples.com: Capture Content Security Policy (CSP) Violations in PHP

NETTUTS.com: Can You Hack Your Own Site? A Look at Some Essential Security Considerations


Community Events











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


introduction hhvm composer example security podcast symfony2 facebook database install package application hack unittest framework project component release performance language

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