function it_uses_registry_to_provide_payment_methods_for_payment(MethodsResolverInterface $firstMethodsResolver, MethodsResolverInterface $secondMethodsResolver, PrioritizedServiceRegistryInterface $resolversRegistry, PaymentMethodInterface $paymentMethod, PaymentInterface $payment)
 {
     $resolversRegistry->all()->willReturn([$firstMethodsResolver, $secondMethodsResolver]);
     $firstMethodsResolver->supports($payment)->willReturn(false);
     $secondMethodsResolver->supports($payment)->willReturn(true);
     $secondMethodsResolver->getSupportedMethods($payment)->willReturn([$paymentMethod]);
     $this->getSupportedMethods($payment)->shouldReturn([$paymentMethod]);
 }
Exemplo n.º 2
0
 /**
  * @return \Closure
  */
 private function createChoiceList()
 {
     return function (Options $options) {
         if (isset($options['subject'])) {
             $resolvedMethods = $this->paymentMethodsResolver->getSupportedMethods($options['subject']);
         } else {
             $resolvedMethods = $this->paymentMethodRepository->findAll();
         }
         return new ObjectChoiceList($resolvedMethods, null, [], null, 'id');
     };
 }