You are here

public function PayPalPaymentWebTestCase::paymentMethodControllerDataExists in PayPal for Payment 7

Checks if a payment method's controller data exists in the database.

Parameters

PaymentMethod $payment_method:

string $table:

Return value

bool

2 calls to PayPalPaymentWebTestCase::paymentMethodControllerDataExists()
PayPalPaymentECPaymentMethodCRUD::testCRUD in paypal_payment_ec/tests/PayPalPaymentECPaymentMethodCRUD.test
Tests CRUD.
PayPalPaymentPPSPaymentMethodCRUD::testCRUD in paypal_payment_pps/tests/PayPalPaymentPPSPaymentMethodCRUD.test
Tests CRUD.

File

paypal_payment/tests/PayPalPaymentWebTestCase.test, line 21
Contains \PayPalPaymentWebTestCase.

Class

PayPalPaymentWebTestCase
Contains PayPal testing helpers.

Code

public function paymentMethodControllerDataExists(PaymentMethod $payment_method, $table) {
  $query = db_select($table);
  $values = $payment_method->controller_data + $payment_method->controller->controller_data_defaults;
  foreach ($values as $property => $value) {
    $query
      ->condition($property, $value);
  }
  $count = $query
    ->countQuery()
    ->execute()
    ->fetchField();
  return (bool) $count;
}