You are here

public function PayPalPaymentPPSPaymentMethodUI::testUI in PayPal for Payment 7

Tests PayPalPaymentPPSPaymentMethodController::payment_method_configuration_form_elements_callback.

File

paypal_payment_pps/tests/PayPalPaymentPPSPaymentMethodUI.test, line 36
Contains \PayPalPaymentPPSPaymentMethodCRUD.

Class

PayPalPaymentPPSPaymentMethodUI
Tests the PayPalPaymentPPSPaymentMethodController UI.

Code

public function testUI() {
  $controller_class_name = 'PayPalPaymentPPSPaymentMethodController';
  $controller = payment_method_controller_load($controller_class_name);
  $controller_data = array(
    'email_address' => 'b@b.b',
    'server' => $controller::SANDBOX_SERVER_URL,
    'capture' => $controller::CAPTURE_MANUAL,
  ) + $controller->controller_data_defaults;
  $account = $this
    ->drupalCreateUser(array(
    'payment.payment_method.create.' . $controller_class_name,
  ));
  $this
    ->drupalLogin($account);
  $this
    ->drupalPost('admin/config/services/payment/method/add/' . $controller_class_name, array(
    'title_specific' => 'Foo',
    'name' => 'foo',
    'controller_form[email_address]' => $controller_data['email_address'],
    'controller_form[server]' => $controller_data['server'],
    'controller_form[capture]' => $controller_data['capture'],
  ), t('Save'));
  $payment_method_loaded = entity_load_single('payment_method', 1);
  $this
    ->assertEqual($controller_data, $payment_method_loaded->controller_data);
}