Level 80
@scwall It’s not working because you don’t resolve Guzzle via the container; you’re justing instantiating it directly with the new keyword.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello Here I am doing tasks in workers every 5 minutes, I would like to do some tests to see if it responds well. I try to mock guzzle but it doesn't work here's what I did:
in test :
$guzzleMock = Mockery::mock(Client::class);
$guzzleMock ->shouldReceive('request') ->andReturn(true);
$this->app->instance(Client::class, $guzzleMock);
$job = new \App\Jobs\ProcessCheck;
$job->handle();
in process :
protected static function pp_client($method,$params=[]){
$params = json_encode($params);
$client = new Client();
$opts = [
'body' => '{"id":"curltext","params":'.$params.'}',
'headers' => ['Content-Type' => 'text/plain'],
];
$response = $client->request('POST','').':8000', $opts);
but it doesn't work I still have a request that is made with the unpatched guzzle
GuzzleHttp\Exception\ConnectException : cURL error 7: Failed to connect to
Thank's in advance
Please or to participate in this conversation.