/** * @covers ::submitForm */ function testSubmitForm() { $this->logger->expects($this->atLeastOnce())->method('info'); $url = new Url($this->randomMachineName()); $this->paymentMethodConfiguration->expects($this->once())->method('delete'); $this->paymentMethodConfiguration->expects($this->atLeastOnce())->method('urlinfo')->with('collection')->willReturn($url); $form = []; $form_state = $this->getMock(FormStateInterface::class); $form_state->expects($this->once())->method('setRedirectUrl')->with($url); $this->sut->submitForm($form, $form_state); }
/** * Returns the title for the payment method configuration edit form. * * @param \Drupal\payment\Entity\PaymentMethodConfigurationInterface $payment_method_configuration * * @return string */ public function title(PaymentMethodConfigurationInterface $payment_method_configuration) { return $this->t('Edit %label', ['%label' => $payment_method_configuration->label()]); }
/** * Disables a payment method configuration. * * @param \Drupal\payment\Entity\PaymentMethodConfigurationInterface $payment_method_configuration * * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function execute(PaymentMethodConfigurationInterface $payment_method_configuration) { $payment_method_configuration->disable(); $payment_method_configuration->save(); return new RedirectResponse($payment_method_configuration->url('collection', ['absolute' => TRUE])); }