class ucRecurringIntegrationTestCase in UC Recurring Payments and Subscriptions 7.2
Same name and namespace in other branches
- 6.2 uc_recurring.test \ucRecurringIntegrationTestCase
Test payment gateway API functions in uc_recurring.
Hierarchy
- class \ucRecurringTestCase extends \UbercartTestCase
Expanded class hierarchy of ucRecurringIntegrationTestCase
File
- ./
uc_recurring.test, line 283 - UC Recurring simpletest
View source
class ucRecurringIntegrationTestCase extends ucRecurringTestCase {
public static function getInfo() {
return array(
'name' => t('Payment integration'),
'description' => t('Test the API functionality to trigger recurring payments via a third party module.'),
'group' => t('Ubercart recurring fees'),
);
}
function setUp() {
parent::setUp('uc_order', 'uc_recurring', 'uc_recurring_product', 'uc_payment', 'uc_recurring_mock_gateway');
$this
->createRecurringUsers();
}
/**
* place an order with the mock gateway payment module
*/
function testRecurringPaymentIntegration() {
global $gateway_status;
$gateway_status = TRUE;
$this
->drupalLogin($this->user_recurring_admin);
$checkoutMessage = $this
->randomName(20);
// select mock gateway for payments
$settings = array(
'uc_recurring_payment_methods[mock_gateway]' => TRUE,
'uc_recurring_checkout_message' => $checkoutMessage,
);
$this
->drupalPost('admin/store/settings/payment/edit/recurring', $settings, t('Save configuration'));
// create products with recurring features
$product = $this
->createProduct();
$recurring_feature = $this
->createRecurringFeature($product->nid, array(
'unlimited_intervals' => TRUE,
));
$this
->drupalLogout();
$order_id = $this
->placeOrderWithRecurringFee($product);
if ($order_id) {
$fee = $this
->getSingleRecurringFeeFromOrder($order_id);
$order = uc_order_load($order_id);
$this
->assertTrue(uc_payment_balance($order) <= 0, t('Order @order_id payment processed', array(
'@order_id' => $order_id,
)));
// test renewal on successful payment processing
$this
->processRecurringFee($fee->rfid, 1);
$order = uc_order_load($this
->lastCreatedOrderId());
$this
->assertTrue(uc_payment_balance($order) <= 0, t('Order @order_id payment processed', array(
'@order_id' => $order->order_id,
)));
// order should now be completed
// test renewal on failed payment processing
$gateway_status = FALSE;
$current_order_id = $this
->lastCreatedOrderId();
$this
->processRecurringFee($fee->rfid, 1);
$order = uc_order_load($this
->lastCreatedOrderId());
$this
->assertEqual($order->order_id, $current_order_id, t('No new order created on failed payment'));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ucRecurringIntegrationTestCase:: |
public static | function | ||
ucRecurringIntegrationTestCase:: |
function | |||
ucRecurringIntegrationTestCase:: |
function | place an order with the mock gateway payment module | ||
ucRecurringTestCase:: |
function | Add a recurring feature to a product. | ||
ucRecurringTestCase:: |
function | Create users with recurring permissions. | ||
ucRecurringTestCase:: |
function | Get a single recurring fee from the order ID. | ||
ucRecurringTestCase:: |
function | Returns the last order_id added in the database. | ||
ucRecurringTestCase:: |
function | place an order for a product with a recurring fee. | ||
ucRecurringTestCase:: |
function | Process a recurring fee. |