I'm writing some integration tests for a big Zend Framework app of mine, using Zend_Test
. But I'm stuck knowing how to write tests for a few of my controllers that utilize a custom-built web API. I am aware of Zend_Controller_Response_HttpTestCase
, which the ZF manual indicates could be helpful here, but I find the documentation to be really sparse.
How can I write my tests without having them call the remote server? Best practices? If Zend_Controller_Response_HttpTestCase
is called for, then how can I use it? Here's a typical test method I would want to use this in:
class FooControllerTest extends ControllerTestCase {
public function testMyNiftyFooPage() {
$this->dispatch('/foo'); // a page that calls a remote API
$this->assertQueryContentContains('h1', 'Hello World');
// other assertions, etc.
}
}