Re: Re: [PEPr] +1 for Web Services::Services_Libravatar

From: Date: Thu, 30 Jun 2011 15:17:56 +0000
Subject: Re: Re: [PEPr] +1 for Web Services::Services_Libravatar
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-54356@lists.php.net to get a copy of this message
On Sun, Jun 26, 2011 at 7:37 PM, Bill Shupp <hostmaster@shupp.org> wrote: > On Sat, Jun 25, 2011 at 9:08 AM, till <till@php.net> wrote: > >> >> >> 4) srvGet() - or rather getSrvRecord() - should utilize Net_DNS2. >> >> >> > >> > >> > Oh for deity's sake. Why? >> > I'm yet to see a convincing argument as to why I should add a dependency >> on >> > an additional library to handle what is provided in *core php* >> > by dns_get_record. That is, other than to please those who think an >> EOL'd >> > php version for Windows servers is a valid SOE, or dependency for >> dependency >> > sake. >> >> Then strictly speaking, we all shouldn't be using any libs at all >> since it's all possible with core PHP. Right? Or maybe not. (I'm being >> sarcastic, of course.) >> > > > I agree there is no need for the Net_DNS2 dependency when the function is > is available in PHP. However, I also agree the call to the function should > be abstracted so that you can minimize the amount of code that is mocked in > a unit test. For example: > > $srv = dns_get_record($subdomain . $domain, DNS_SRV); > > > Could be changed to: > > > $srv = $this->_dnsGetRecord($dubdomain . $domain, DNS_SRV); > > > And that method would simply call the dns_get_record() function and return the results. This > might seem odd to someone that hasn't done unit tests with mocking, but it allows you to > minimize the amount of dependency injection you do, and is really easy to do. When you do write > the test, you'll want to make sure you test all possible error cases from dns_get_record(). > > +1

« previous php.pear.dev (#54356) next »