Closed anthonysterling closed 6 years ago
Why would you mock this out for tests? Would be helpful to have a test that shows how to do it and also update the docs.
Hello @bracki.
Why would you mock this out for tests?
I needed to write some integration tests for one of our services, and this change allowed me to supply a mock Guzzle client that did not persist the collected metrics during the test runs. As the doRequest
method is private sub-classing it wasn't an option, this change seemed to be the best non-breaking change with the additional benefit of allowing the dependency to be injected if required.
I'm more than happy to add a test covering this change and updating the docs if you feel this change is suitable.
This PR enables the ability to inject a Guzzle Client in to the Push Gateway on creation, allowing us to mock/configure the Guzzle Client for tests.