Hi Zenders,

It's my impression, or perhaps just my opinion, that there are a number
of methods to designing the "model" portion of a Zend MVC app, depending
on the complexity your project needs.  So for example, you could just
have your controllers interact with various Zend_Db classes directly, or
have them interact with a domain model consisting of classes that either
extend, or wrap/delegate-to appropriate instances of Zend_Db_Table and
Zend_Db_Row classes.

I'm trying to work out what the best methods would be to unit test this
model layer with PHPUnit, independently of a "real" database (or at
least, be able to quickly reset the database to a known state at the
start of each test).  I need some advice on "best practices" or even
just "practices that have worked pretty well for me."

Is it possible to create mock Zend_Db_Table and Zend_Db_Row classes that
extend Zend_Db_Table_Abstract and Zend_Db_Row_Abstract, but simply
operate on some in-memory data?  Is that even a sensible way to try to
go about it?  Better still, might there already be a framework for doing
this sort of thing?  The less boilerplate I need to do just to run some
tests, the better.

Thanks in advance
--chuck--

Reply via email to