mercredi 20 janvier 2021

mock \Unirest\Request Laravel

I created this method that gives me the get to download the cards on trello:

public function get_data(string $url) {
   
        $headers = array('Accept' => 'application/json');
        $query = array('key' => env('TRELLO_KEY'), 'token' => env('TRELLO_TOKEN'));
        $r = \Unirest\Request::get($url, $headers, $query);
        return $r->body;

    }

I was wondering how I could mock this method in particular of:

\Unirest\Request::get($url, $headers, $query);

I was wondering if it was possible to mocking it with HTTP::fake()

Aucun commentaire:

Enregistrer un commentaire