You are here

function PaymentmethodbasicTestPaymentMethodBasicControllerWebTestCase::testPaymentMethodFormCallback in Payment 7

Test BasicPaymentMethodController::payment_method_configuration_form_elements_callback.

File

modules/paymentmethodbasic/tests/paymentmethodbasic_test/tests/PaymentmethodbasicTestPaymentMethodBasicControllerWebTestCase.test, line 79
Contains class PaymentmethodbasicTestPaymentMethodBasicControllerWebTestCase.

Class

PaymentmethodbasicTestPaymentMethodBasicControllerWebTestCase
Tests PaymentMethodBasicController functionality.

Code

function testPaymentMethodFormCallback() {
  $account = $this
    ->drupalCreateUser(array(
    'payment.payment_method.create.PaymentMethodBasicController',
  ));
  $this
    ->drupalLogin($account);
  $this
    ->drupalPost('admin/config/services/payment/method/add/PaymentMethodBasicController', array(
    'title_specific' => 'Foo',
    'name' => 'foo',
    'controller_form[message][value]' => 'bar',
    'controller_form[status]' => PAYMENT_STATUS_FAILED,
  ), t('Save'));
  $payment_method = entity_load_single('payment_method', 3);
  $reference = array(
    'message' => 'bar',
    'status' => PAYMENT_STATUS_FAILED,
    'text_format' => 'plain_text',
  );
  debug($payment_method->controller_data);
  $this
    ->assertFalse(array_diff_assoc($reference, $payment_method->controller_data), "An BasicPaymentMethodController payment method's controller data is correctly saved by the payment method form.");
}