Class "GuzzleHttp\HandlerStack" not found in (laravel) Pest-Test

138 Views Asked by At

i want to test an api-client. the api-client uses Illuminate\Support\Facades\Http to make requests. when i use it in tinker everything is ok:

> $response = Bitwarden::listItems()
= Illuminate\Support\Collection {#6782
    all: [
      {#6854
        +"object": "item",
       ....
      },
    ],
  }

My test looks like this:

it('can list the items', function () {
   $response = Bitwarden::listItems();
   expect($response)->toBeArray();
});

and result is

 FAILED  Tests\BitwardenCliTest > it can list the items                              Error   
  Class "GuzzleHttp\HandlerStack" not found

  at vendor/laravel/framework/src/Illuminate/Http/Client/PendingRequest.php:1145
    1141▕      * @return \GuzzleHttp\HandlerStack
    1142▕      */
    1143▕     public function buildHandlerStack()
    1144▕     {
  ➜ 1145▕         return $this->pushHandlers(HandlerStack::create($this->handler));
    1146▕     }
    1147▕ 
    1148▕     /**
    1149▕      * Add the necessary handlers to the given handler stack.

i guess i missed something in setting up pest. please give me a hint. thx :)

i want the client to work in test like it does in tinker

1

There are 1 best solutions below

1
Alex On