You are here

function ucRecurringTestCase::createRecurringFeature in UC Recurring Payments and Subscriptions 7.2

Same name and namespace in other branches
  1. 6.2 uc_recurring.test \ucRecurringTestCase::createRecurringFeature()

Add a recurring feature to a product.

4 calls to ucRecurringTestCase::createRecurringFeature()
ucRecurringAPITestCase::testRecurringAdminFunctions in ./uc_recurring.test
Test administrator functions.
ucRecurringAPITestCase::testRecurringOrders in ./uc_recurring.test
Test customer functions of purchasing an order with recurring product.
ucRecurringIntegrationTestCase::testRecurringPaymentIntegration in ./uc_recurring.test
place an order with the mock gateway payment module
ucRecurringPaypalWPSTestCase::testRecurringPaypal in modules/uc_recurring_hosted/uc_recurring_hosted.test
Place an order with the Paypal WPS gateway.

File

./uc_recurring.test, line 13
UC Recurring simpletest

Class

ucRecurringTestCase
@file UC Recurring simpletest

Code

function createRecurringFeature($nid, $feature = array()) {
  $interval_units = array(
    'days',
    'months',
    'years',
  );
  $defaults = array(
    'model' => '',
    'fee_same_product' => FALSE,
    'fee_amount' => rand(1, 999),
    'initial_charge_value' => rand(1, 10),
    'initial_charge_unit' => $interval_units[rand(0, 2)],
    'regular_interval_value' => rand(1, 10),
    'regular_interval_unit' => $interval_units[rand(0, 2)],
    'unlimited_intervals' => FALSE,
    'number_intervals' => rand(3, 10),
  );
  $feature = array_merge($defaults, $feature);
  $this
    ->drupalPost('node/' . $nid . '/edit/features/recurring/add', $feature, t('Save feature'));
  $this
    ->assertRaw(t('The product feature has been added.'), t('"The product feature has been added." was displayed on the edit features page'));
  return $feature;
}