Description:
------------
At the moment, Services_Hatena instantiates XML_RPC clients in the middle of methods to get code.
Basically, classes do:
class Foo extends Services_Hatena {
public function execute() {
// new XML_RPC_Client() in here
}
}
If you were to change the API to expect you to instantiate an XML_RPC_Client in the constructor, testability is markedly improved - you can inject a mock client which provides dummy results, but otherwise asserts your package functions correctly.
IE - You could do:
$service = new Services_Hatena_Bookmarknum(new XML_RPC_Client());
$service = new Services_Hatena_Bookmarknum(new Mock_XML_RPC_Client());
(or pass it in to the factory method)
If the factory doesn't get passed any particular arguments, you could still instantiate the relevant XML_RPC client.
This would prevent Bug #14872 from ever occurring again.