Skip to content

Commit

Permalink
test: update request service test
Browse files Browse the repository at this point in the history
  • Loading branch information
Matiasnickolas committed Jun 6, 2024
1 parent 9abd461 commit 2d30fcc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/RequestServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ class RequestServiceTest extends TestCase
public function it_send_the_headers_provided_by_the_given_options()
{
$expectedHeaders = ['api_key' => 'commerce_code', 'api_secret' => 'fakeApiKey'];

$timeOut = 10;
$optionsMock = $this->createMock(Options::class);
$optionsMock
->expects($this->once())
->method('getHeaders')
->willReturn($expectedHeaders);
$optionsMock
->expects($this->once())
->method('getTimeout')
->willReturn($timeOut);

$httpClientMock = $this->createMock(HttpClient::class);
$httpClientMock
->expects($this->once())
->method('request')
->with($this->anything(), $this->anything(), $this->anything(), $this->equalTo(['headers' => $expectedHeaders,]))
->with($this->anything(), $this->anything(), $this->anything(), $this->equalTo(['headers' => $expectedHeaders,
'timeout' => $timeOut]))
->willReturn(
new Response(200, [], json_encode(['token' => 'mock', 'url' => 'https://mock.cl/',]))
);
Expand Down

0 comments on commit 2d30fcc

Please sign in to comment.