title: A PHPUnit Testing Strategy for Zend Application
body: <p>I have been developing a typical blog-style application in Zend.  So far I have been getting by on minimal testing, but now I need to bullet proof things and I'm chasing some advice or tips on my unit testing strategy.</p>
  
  <p>Models:</p>
  
  <ul>
  <li>To test models, I have been extending PHPUnit_Framework_TestCase.  This seems to work fine.</li>
  <li>I have read up on Zend_Test_PHPUnit_DatabaseTestCase, however I'm not sure where I would use this?  I thought it might negate the need for me to drop/create the DB between each test, but that doesn't seem to be the case?</li>
  <li>Dropping/creating the DB between each test has become quite painful because I have a lot of test data.  Is there any easy way to deal with this (e.g. mock the DB?), or should I be cutting down on my test data?  (At the moment I am simply calling <code>exec('mysql &lt; TestSetup.sql --user=root --password=password')</code> in the setUp() method of my test cases).</li>
  </ul>
  
  <p>Controllers and Views:</p>
  
  <ul>
  <li>To test controllers and views I am extending Zend_Test_PHPUnit_ControllerTestCase.  This seems to work fine.  </li>
  <li>Again, setting up/tearing down seems to be the biggest bug bear.  I was considering removing that step, and only using asserts that were unaffected by changes in db content.  Is this a common practice?</li>
  </ul>
  
  <p>Your thoughts are much appreciated!</p>