Skip to content

Commit

Permalink
fix: remode dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
brokeyourbike committed Nov 27, 2023
1 parent 324670f commit c3b27e1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
9 changes: 0 additions & 9 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ public function getConfig(): ConfigInterface
return $this->config;
}

public function ping(): bool
{
$response = $this->performRequest(HttpMethodEnum::OPTIONS, 'GetProvidusAccount', []);
if ($response->getStatusCode() === 200) {
return true;
}
return false;
}

public function fetchAccount(string $accountNumber): AccountResponse
{
$response = $this->performRequest(HttpMethodEnum::POST, 'GetProvidusAccount', ['accountNumber' => $accountNumber]);
Expand Down
33 changes: 1 addition & 32 deletions tests/FetchAccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,35 +68,4 @@ public function it_can_prepare_request(): void
$requestResult = $api->fetchAccount('account123');
$this->assertInstanceOf(AccountResponse::class, $requestResult);
}

/** @test */
public function it_can_ping(): void
{
$mockedConfig = $this->getMockBuilder(ConfigInterface::class)->getMock();
$mockedConfig->method('getUrl')->willReturn('https://api.example/');

$mockedResponse = $this->getMockBuilder(ResponseInterface::class)->getMock();
$mockedResponse->method('getStatusCode')->willReturn(200);

/** @var \Mockery\MockInterface $mockedClient */
$mockedClient = \Mockery::mock(\GuzzleHttp\Client::class);
$mockedClient->shouldReceive('request')->withArgs([
'OPTIONS',
'https://api.example/GetProvidusAccount',
[
\GuzzleHttp\RequestOptions::HEADERS => [
'Accept' => 'application/json',
],
],
])->once()->andReturn($mockedResponse);

/**
* @var ConfigInterface $mockedConfig
* @var \GuzzleHttp\Client $mockedClient
* */
$api = new Client($mockedConfig, $mockedClient);

$requestResult = $api->ping();
$this->assertTrue($requestResult);
}
}
}

0 comments on commit c3b27e1

Please sign in to comment.