Using tests to think through your code TDT (Test Driven Thinking)
In this section, we are just going to think about a small chunk of code using tests. It is not TDD in that I am testing Red, Green, and Refactor. It just uses unit tests to build, think, and iterate over simple or complex ideas. If you find yourself reloading a browser to see if something is working right, then it is a good sign. You can just be writing a test. Even if you end up not keeping the test, it will get you to the final code quicker.
Getting ready
SSH into Homestead using the command homestead ssh
and cd into the recipe directory and let's get testing. Also, we are going to use the client that we made to query the Marvel Comics API. So, you will need an API Key and a Token from them at https://developer.marvel.com/account.
How to do it...
First, we need to add the key and secret to your
.env
file:Then, we will make a test around this setup:
>php artisan make:test MarvelApiClientTest
First, let's just write in the...