Skip to content

Instantly share code, notes, and snippets.

@Frank-Magmodules
Created November 28, 2023 08:08
Show Gist options
  • Save Frank-Magmodules/3b908b149c1032bdcbcad9c67bb35929 to your computer and use it in GitHub Desktop.
Save Frank-Magmodules/3b908b149c1032bdcbcad9c67bb35929 to your computer and use it in GitHub Desktop.
Mollie-697
diff --git a/Service/Order/MethodCode.php b/Service/Order/MethodCode.php
index 10b2b0b0..4e9514f5 100644
--- a/Service/Order/MethodCode.php
+++ b/Service/Order/MethodCode.php
@@ -34,7 +34,7 @@ private function paymentLinkMethod(OrderInterface $order): string
return '';
}
- if (count($additionalInformation['limited_methods']) !== 1) {
+ if (!is_array($additionalInformation['limited_methods']) || count($additionalInformation['limited_methods']) !== 1) {
return '';
}
diff --git a/Test/Integration/Service/Order/MethodCodeTest.php b/Test/Integration/Service/Order/MethodCodeTest.php
index be04f8de..42956047 100644
--- a/Test/Integration/Service/Order/MethodCodeTest.php
+++ b/Test/Integration/Service/Order/MethodCodeTest.php
@@ -71,4 +71,20 @@ public function testReturnsPaymentLinkReturnsTheSingleLimitedMethod(): void
$this->assertEquals('ideal', $result);
}
+
+ public function testReturnsNothingWhenLimitedMethodsIsNull(): void
+ {
+ $order = $this->loadOrderById('100000001');
+ $order->getPayment()->setMethod('mollie_methods_paymentlink');
+ $order->getPayment()->setAdditionalInformation(
+ 'limited_methods',
+ null
+ );
+
+ $instance = $this->objectManager->create(MethodCode::class);
+
+ $result = $instance->execute($order);
+
+ $this->assertEquals('', $result);
+ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment