Skip to content

Commit

Permalink
Support empty responses (#581)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpaul authored Nov 2, 2023
1 parent b043fa6 commit 5940427
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 35 deletions.
6 changes: 5 additions & 1 deletion src/Adyen/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ function ($val) {
$url .= '?' . http_build_query($queryParams);
}

return $curlClient->requestHttp($this, $url, $bodyParams, $method, $requestOptions);
$response = $curlClient->requestHttp($this, $url, $bodyParams, $method, $requestOptions);
if (!is_array($response)) {
return [];
}
return $response;
}

/**
Expand Down

This file was deleted.

19 changes: 6 additions & 13 deletions tests/Unit/ModelBasedCheckoutTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php
<?php declare(strict_types=1);

namespace Adyen\Tests\Unit;

use Adyen\AdyenException;
use Adyen\Model\Checkout\Amount;
use Adyen\Model\Checkout\CardDetailsRequest;
use Adyen\Model\Checkout\CheckoutPaymentMethod;
Expand Down Expand Up @@ -309,25 +310,17 @@ public static function successGetStoredPaymentMethodsProvider()
}

/**
* @param string $jsonFile
* @param int $httpStatus
*
* @dataProvider successDeleteStoredPaymentMethodsProvider
* @throws AdyenException
*/
public function testDeleteStoredPaymentMethodsSuccess($jsonFile, $httpStatus)
public function testDeleteStoredPaymentMethodsSuccess()
{
$client = $this->createMockClient($jsonFile, $httpStatus);
$client = $this->createMockClient(null, 204);

$service = new RecurringApi($client);

$service->deleteTokenForStoredPaymentDetails("123");
}

public static function successDeleteStoredPaymentMethodsProvider()
{
return array(
array('tests/Resources/ModelBasedCheckout/deleteStoredPaymentMethods-success.json', 200),
);
$this->assertTrue(true, 'no exception');
}

public function testPaymentMethodSerialization()
Expand Down

0 comments on commit 5940427

Please sign in to comment.