At work we have a component in our internal framework for fetching content from remote sources. The component utilizes something called availability caching which means that it will cache the remote content and use it when the remote server is down. We use Zend_Http_Client internally and to fully test our component we needed the remote server (which is not really a remote server at all in our test suite) to fail on demand.
In our tests we simply use the Zend_Http_Client_Adapter_Test adapter with the Zend_Http_Client instance instead of the default adapter. Using this we can tell the client what to return so we can make sure our own component behaves like it should. I implemented a method in the test adapter called setNextRequestWillFail() which takes a boolean flag as a parameter. The result when calling this method with boolean true is that the adapter will throw a Zend_Http_Client_Adapter_Exception exception on the next request. This allowed us to force the “remote server” to fail so we could test our availability cache.
The fix has been commited to Zend Framework trunk and will hopefully be added soon.