Beispiel #1
0
 /**
  * @Transform /^"([^"]+)" payment(s)?$/
  */
 public function getPaymentMethodByName($paymentMethodName)
 {
     $paymentMethod = $this->paymentMethodRepository->findOneByName($paymentMethodName);
     if (null === $paymentMethod) {
         throw new \InvalidArgumentException(sprintf('Payment method with name "%s" does not exist.', $paymentMethodName));
     }
     return $paymentMethod;
 }
 /**
  * @Transform :paymentMethod
  */
 public function getPaymentMethodByName($name)
 {
     $paymentMethod = $this->paymentMethodRepository->findOneByName($name);
     Assert::notNull($paymentMethod, sprintf('Cannot find payment method named %s', $name));
     return $paymentMethod;
 }
 /**
  * @Transform /^"([^"]+)" payment(s)?$/
  * @Transform :paymentMethod
  */
 public function getPaymentMethodByName($paymentMethodName)
 {
     $paymentMethod = $this->paymentMethodRepository->findOneByName($paymentMethodName);
     Assert::notNull($paymentMethod, sprintf('Payment method with name "%s" does not exist', $paymentMethodName));
     return $paymentMethod;
 }
 function it_throws_element_not_found_exception_if_payment_method_has_not_been_found(PaymentMethodRepositoryInterface $paymentMethodRepository)
 {
     $paymentMethodRepository->findOneByName('Free')->willReturn(null);
     $this->shouldThrow(\InvalidArgumentException::class)->during('getPaymentMethodByName', ['Free']);
 }