Skip to content

Commit

Permalink
Removed strict return types and null coalescing for 5.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Feijs authored and frankverhoeven committed Aug 9, 2019
1 parent 232360a commit b0de21b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/Message/Response/CancelOrderResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ final class CancelOrderResponse extends FetchOrderResponse
*/
public function isSuccessful()
{
return 'canceled' === $this->data['status'] ?? '';
if (!isset($this->data['status'])) {
return false;
}

return 'canceled' === $this->data['status'];
}
}
8 changes: 3 additions & 5 deletions tests/Message/CancelOrderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ public function setUp()
$this->request = new CancelOrderRequest($this->httpClient, $this->getHttpRequest());
}

public function insufficientDataProvider(): array
public function insufficientDataProvider()
{
return [
[['apiKey' => 'mykey']],
[['transactionReference' => 'myref']],
];
}

public function responseDataProvider(): array
public function responseDataProvider()
{
return [
[['id' => 'ord_kEn1PlbGa'], false],
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testGetDataWillReturnEmptyArray()
/**
* @dataProvider responseDataProvider
*/
public function testSendData(array $responseData, bool $success)
public function testSendData(array $responseData, $success)
{
$response = $this->createMock(ResponseInterface::class);
$response->expects(self::once())
Expand All @@ -80,13 +80,11 @@ public function testSendData(array $responseData, bool $success)
['Authorization' => 'Bearer mykey']
)->willReturn($response);


$this->request->initialize(['apiKey' => 'mykey', 'transactionReference' => 'ord_kEn1PlbGa']);
$voidResponse = $this->request->sendData([]);

$this->assertInstanceOf(CancelOrderResponse::class, $voidResponse);
$this->assertEquals($success, $voidResponse->isSuccessful());
$this->assertSame('ord_kEn1PlbGa', $voidResponse->getTransactionReference());
}

}

0 comments on commit b0de21b

Please sign in to comment.