Skip to content

Commit

Permalink
Formatting and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
javier-villatoro committed Aug 6, 2024
1 parent fa9fa2b commit 89c716f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Exceptions/LeverClientException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ class LeverClientException extends RuntimeException
{
public function __construct($message, $code = 0, \Exception $previous = null)
{
parent::__construct("Bluelightco\LeverPhp: " . $message, $code, $previous);
parent::__construct("Bluelightco\LeverPhp: ".$message, $code, $previous);
}
}
10 changes: 5 additions & 5 deletions src/Http/Client/LeverClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace Bluelightco\LeverPhp\Http\Client;

use Bluelightco\LeverPhp\Exceptions\LeverClientException;
use Bluelightco\LeverPhp\Http\Middleware\LeverRateStore;
use Bluelightco\LeverPhp\Http\Middleware\QueryStringCleanerMiddleware;
use Bluelightco\LeverPhp\Http\Responses\ApiResponse;
use Exception;
use GrahamCampbell\GuzzleFactory\GuzzleFactory;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\HandlerStack;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\LazyCollection;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Spatie\GuzzleRateLimiterMiddleware\RateLimiterMiddleware;
use Spatie\GuzzleRateLimiterMiddleware\Store;
use Illuminate\Support\Facades\Log;
use Bluelightco\LeverPhp\Exceptions\LeverClientException;
use Exception;

class LeverClient
{
Expand Down Expand Up @@ -486,7 +486,7 @@ private function checkExpandOptions(array|string $expand): bool
return true;
}

private function handleException(\Exception $e, string $method, array $body = []): void
private function handleException(Exception $e, string $method, array $body = []): void
{
$logDetails = [
'package' => 'Bluelightco\LeverPhp',
Expand All @@ -502,7 +502,7 @@ private function handleException(\Exception $e, string $method, array $body = []
$logDetails['response'] = $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null;
}

Log::error("HTTP Error in $method: " . $e->getMessage(), $logDetails);
Log::error("HTTP Error in $method: ".$e->getMessage(), $logDetails);

$type = $e instanceof ClientException ? 'ClientException' : 'Exception';

Expand Down
4 changes: 2 additions & 2 deletions tests/OpportunitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use GuzzleHttp\Psr7\Response;
use Illuminate\Support\LazyCollection;
use Bluelightco\LeverPhp\Exceptions\LeverClientException;
use RuntimeException;

class OpportunitiesTest extends TestCase
{
Expand Down Expand Up @@ -108,7 +108,7 @@ public function create_opportunity()
/** @test */
public function fail_to_create_opportunity_when_no_perform_as_parameter_included()
{
$this->expectException(LeverClientException::class);
$this->expectException(RuntimeException::class);

$this->mockHandler->append(new Response(400, [],
'{"code": "BadRequestError", "message": "Missing perform_as parameter. Please specify a user for which to perform this create."}'
Expand Down

0 comments on commit 89c716f

Please sign in to comment.