News Feed
Sections




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

Zachary Burnham's Blog:
Code Setting up unit testing in Zend Framework with multiple databases
February 11, 2011 @ 10:15:26

Zachary Burnham has a new post to his blog looking at his technique for unit testing multiple databases in a Zend Framework application.

As part of this project, I'm required to work with two separate databases; the osCommerce database and a new database to track barcodes on the coupons. I found myself needing to rewrite the purchase rules that we'd created in osCommerce in a ZF model. The rules are complex, compounded by the fact that we can't use the customer IDs in osCommerce, we're only able to use the customer's utility account number, as well as the fact that the purchase rules limit purchases by category and not product, and a product can be in multiple categories... well, you get the idea.

He includes a relevant bit from his application.ini to show the database setup and the code for a base testing class (originally from Matthew Turland) to work with the databases. He had an issue where he was getting bad "not found" errors when trying to load the classes in the tests, but eventually figured out that it was the framework not being bootstrapped that was causing the problem. He shows his modified phpunit.xml configuration and has a sample test to show how it all ties together.

0 comments voice your opinion now!
zendframework phunit unittest multiple database


blog comments powered by Disqus

Similar Posts

Jani Hartikainen's Blog: Complex custom elements in Zend_Form

Zend Developer Zone: Flex and Zend Framework - Part 1

Zend: Zend Framework Database Access Webinar (Oct 31st, 2007)

Carl Vuorinen: Controller testing with database fixtures in Zend Framework

DevShed: Working with Strings and the Composite Pattern in PHP 5


Community Events





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


code podcast interview laravel opinion release introduction unittest list threedevsandamaybe series install developer testing wordpress community language framework refactor api

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