PHP-DNS-SERVER
PHP-DNS-SERVER copied to clipboard
Google DNS over HTTPS resolver
This branch adds a new resolver that uses Google's HTTPS service to resolve DNS records user requested. Another example file is provided which shows proof of concept.
I've finally gotten around to review this, and it does not work for me... In your tests, you're not testing the getAnswer
method which is pretty important...
I was thinking how to achieve that but getAnswer would fire an http request and that would not be a unit test anymore. Maybe you have an idea how to improve this test?
Fair point, it is no longer a unit test. But the fact remains that I cannot get the feature to work. I'm not familiar with the API, do you need a key or something?
No key is needed for API consumption. And I completely agree with you that the test is insufficient. Perhaps I could write a functional test and actually contact the API, the main concern is would CI allow outcoming HTTP request. Other thing I'm willing to try is mocking, that would involve extracting method that contacts the API in separate service and injecting it in resolver - this way the whole service could be replaced with stub. I will try second solution in following days.