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?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2rdiErG
via IFTTT
Aucun commentaire:
Enregistrer un commentaire