Testing API Calls in PHP With Guzzle Mocks
I’m working on a CouchDB library for PHP, and so I needed to write some tests for it. CouchDB has an HTTP API so I’m basically making web requests and while I could certainly set up a test database and run full-on integration tests, there are a few limitations with that approach. Firstly: it means I’m testing the database as well, which isn’t what I want and brings extra dependencies that make the tests harder to run. Also: I want to be able to test error cases, rate limiting and so on, that would be difficult to recreate reliably.
With all this in mind, I decided to just mock the CouchDB API for the calls I expected to make to it. Guzzle makes this much easier than I expected and it means that I can test all kinds of edge cases without trying to make contrived sequences of operations. As a side effect, the tests will run a lot faster using mocks than if I were making actual API calls to a remote database! https://goo.gl/HVXJdV #DataIntegration #ML
R/Finance 2018, Chicago June 1-2
The tenth annual R/Finance conference will be held in Chicago, June 1-2 2018. This is a fantastic conference for anyone working with R in the finance industry, or doing research around R in finance…
… https://goo.gl/5XBXYZ #BigData #Analytics
Is It Time to Talk About Race and Religion at Work?
Some corporate leaders are encouraging employees to engage in sensitive conversations to build more-inclusive workplaces. https://goo.gl/GebuUB #GlobalHR #HRTech
