You are here

static function PaymentWebTestCase::paymentCreate in Payment 7

Create, save, and return a Payment.

Parameters

integer $uid: The user ID of the payment's owner.

PaymentMethod $payment_method: An optional payment method to set. Defaults to PaymentMethodUnavailable.

Return value

Payment

6 calls to PaymentWebTestCase::paymentCreate()
PaymentreferenceTestQueueWebTestCase::testQueueCRUD in modules/paymentreference/tests/paymentreference_test/tests/PaymentreferenceTestQueueWebTestCase.test
PaymentreferenceTestQueueWebTestCase::testQueueFieldImplementation in modules/paymentreference/tests/paymentreference_test/tests/PaymentreferenceTestQueueWebTestCase.test
PaymentTestActionHookAndCallbackWebTestCase::testActionHooksAndCallbacks in tests/payment_test/tests/PaymentTestActionHookAndCallbackWebTestCase.test
Test whether all action hooks and callbacks are invoked.
PaymentTestPaymentEntityPermissionWebTestCase::testPaymentEntityPermissions in tests/payment_test/tests/PaymentTestPaymentEntityPermissionWebTestCase.test
PaymentTestPaymentValidationWebTestCase::testPaymentValidation in tests/payment_test/tests/PaymentTestPaymentValidationWebTestCase.test
Test payment validation.

... See full list

File

tests/PaymentWebTestCase.test, line 30

Class

PaymentWebTestCase
Provides reusable code for testing payments and payment methods.

Code

static function paymentCreate($uid, PaymentMethod $payment_method = NULL) {
  $payment_method = $payment_method ? $payment_method : new PaymentMethodUnavailable();
  $payment = new Payment(array(
    'currency_code' => 'XXX',
    'description' => 'This is the payment description',
    'finish_callback' => 'payment_test_finish_callback',
    'method' => $payment_method,
    'uid' => $uid,
  ));
  $payment
    ->setLineItem(new PaymentLineItem(array(
    'name' => 'foo',
    'amount' => 1.0,
    'tax_rate' => 0.1,
  )));
  return $payment;
}