Skip to content

Commit

Permalink
Test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed Jul 11, 2024
1 parent 281605f commit c1820ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GraphQL/Resolver/General/MolliePaymentMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private function getMethods(float $amount, ?string $currency, int $storeId): ?ar

if ($currency === null) {
$available = $mollieApiClient->methods->allAvailable();
$available = array_filter((array)$available, function (Method $method) use ($storeId) {
$available = array_filter((array)$available, function (Method $method) {
return $method->status == 'activated';
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?php
/*
* Copyright Magmodules.eu. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Mollie\Payment\Test\Integration\GraphQL\Resolver\General;

use Magento\PageCache\Model\Cache\Type;
use Mollie\Api\Endpoints\MethodEndpoint;
use Mollie\Api\MollieApiClient;
use Mollie\Api\Resources\Method;
use Mollie\Payment\Test\Fakes\Service\Mollie\FakeMollieApiClient;
use Mollie\Payment\Test\Integration\GraphQLTestCase;

Expand Down Expand Up @@ -179,12 +184,16 @@ private function callEndpoint($methods): array
')['molliePaymentMethods']['methods'];
}

private function arrayToObject($array): \stdClass
private function arrayToObject($array, $nested = false)
{
$object = new \stdClass();
$client = $this->objectManager->get(\Mollie\Api\MollieApiClient::class);
$method = new Method($client);
$method->status = 'activated';

$object = $nested ? new \stdClass() : $method;
foreach ($array as $key => $value) {
if (is_array($value)) {
$value = $this->arrayToObject($value);
$value = $this->arrayToObject($value, true);
}

$object->$key = $value;
Expand Down

0 comments on commit c1820ac

Please sign in to comment.