Skip to content

Commit

Permalink
feat(Client): Add __debugInfo method for debugging
Browse files Browse the repository at this point in the history
- Added __debugInfo method to return debug information
- Included details about httpClient, httpClientResolver, handlerStack, and httpOptions
  • Loading branch information
guanguans committed Mar 6, 2024
1 parent 5854bb5 commit 0d9ab74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Foundation/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ public function __construct(?Authenticator $authenticator = null)
$this->authenticator = $authenticator ?? new NullAuthenticator;
}

public function __debugInfo(): array
{
return $this->withDebugInfo([
'httpClient' => $this->getHttpClient(),
'httpClientResolver' => $this->getHttpClientResolver(),
'handlerStack' => $this->getHandlerStack(),
'httpOptions' => $this->getHttpOptions(),
]);
}

/**
* @return Response|ResponseInterface
*
Expand Down
1 change: 1 addition & 0 deletions tests/Foundation/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
static fn (Client $client): \GuzzleHttp\Client => new \GuzzleHttp\Client($client->getHttpOptions())
)
->mock([create_response(faker()->text())])
->dump()
->assertCanSendMessage(Message::make(['text' => 'This is text.']));
})->group(__DIR__, __FILE__);

Expand Down

0 comments on commit 0d9ab74

Please sign in to comment.