I have a class like this:
class CategoryClient
{
private $categories;
/**
* Constructor
* Retrieves JSON File
*/
public function __construct(Client $client)
{
$response = $client->request('GET', config('services.url'));
$this->categories = collect(json_decode($response->getBody(), true));
}
}
How would I mock the json response for testing purposes in PHPUnit? and set the $this->categories
variable?