Using VCR for API testing
Alright, we are now making calls with Guzzle to a real API (see the section Using Tests to Think Through Your Code TDT (Test Driven Thinking) earlier in this chapter). But they are going to get pretty annoyed with us if we are hitting their API for all our tests. Also, it is going to slow down our tests. Right now, the speed difference is nominal since there is only one request, but once there are more, the time will really add up. So, to prevent this, we begin to use VCR to create fixtures of our HTTP requests and responses so that the next time we call them, they are delivered to us instead.
Getting ready
This one is a bit tricky on the installation. I will cover the installation in the upcoming steps, and then go into ...
Get Laravel 5.x Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.