Learning lessons at ZendUncon

Over on his blog, Michelangelo van Dam – the leader of the ZendCon UnCon ’12 – has posted the latest in a series of posts about things he learned attending the ZendCon UnCon. This latest post is how he implemented the idea of using fixtures and PHPUnit to test databases.

Here’s a quick sample to wet your whistle.

In my previous post I already mentioned Sebastian Jerzy Wilczyński (@dj_sebastian_w) and his uncon session “Unit Testing for Databases using fixtures and phpunit”. It made me wonder how much difference it would make if you use fixtures instead of testing database interactions using predefined sets of data.

Since I work a lot with Zend Framework I was looking at how I could use fixtures and mock objects to follow Sebastian’s guidelines. So I gave it a try. This is what I came up with.

Like most of Mike’s articles, this article is long on the HOW and long on the WHY. He doesn’t leave you hanging about why you want to do this, nor does he fail to show you exactly how. Since Mike is a Zend Framework developer, everything he shows is centered around projects using Zend Framework.

About Cal Evans

Many moons ago, at the tender age of 14, Cal touched his first computer. (We're using the term "computer" loosely here, it was a TRS-80 Model 1) Since then his life has never been the same. He graduated from TRS-80s to Commodores and eventually to IBM PC's. For the past 10 years Cal has worked with PHP and MySQL on Linux OSX, and when necessary, Windows. He has built on a variety of projects ranging in size from simple web pages to multi-million dollar web applications. When not banging his head on his monitor, attempting a blood sacrifice to get a particular piece of code working, he enjoys building and managing development teams using his widely imitated but never patented management style of "management by wandering around". Cal is happily married to wife 1.31, the lovely and talented Kathy. Together they have 2 kids who were both bright enough not to pursue a career in IT. Cal blogs at http://blog.calevans.com and is the founder and host of Nomad PHP