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
since i'm using jetstream in this project, i "reinstalled" it using pest as testing-framework like mentioned here https://jetstream.laravel.com/installation.html#:~:text=If%20you%20would%20like%20to%20use%20Pest%20PHP%20for%20testing%2C%20you%20may%20use%20the%20%2D%2Dpest%20switch%20to%20install%20a%20Pest%20test%20suite%20instead%20of%20the%20default%20PHPUnit%20test%20suite.
now my tests are passing!