In all of the prior examples, an HTTP client was never specified.
When this is the case, a new instance of
Zend_Http_Client will be created with its default
options and used by
The HTTP client can be retrieved at any time with the
getHttpClient() method. For most cases, the default
HTTP client will be sufficient. However, the
setHttpClient() method allows for a different
HTTP client instance to be injected.
setHttpClient() is particularly useful for unit testing.
When combined with the
services can be mocked out for testing. See the unit tests for
Zend_XmlRpc_Client for examples of how to do this.