function CommerceRecurringTestCase::testCommerceRecurringEntityCreation in Commerce Recurring Framework 7.2
Create a Recurring entity.
File
- tests/
commerce_recurring.test, line 181 - Unit tests for the commerce recurring module.
Class
- CommerceRecurringTestCase
- @file Unit tests for the commerce recurring module.
Code
function testCommerceRecurringEntityCreation() {
$product = $this
->createRecurringProduct();
$line_item = commerce_cart_product_add_by_id($product->product_id);
$order = commerce_order_load($line_item->order_id);
$recurring_entity = commerce_recurring_new_from_product($order, $product, $line_item->commerce_unit_price[LANGUAGE_NONE][0], $line_item->quantity);
entity_save('commerce_recurring', $recurring_entity);
$recurring_entity_load = entity_load_single('commerce_recurring', $recurring_entity->id);
$this
->assertTrue($recurring_entity->id == 1, t('Recurring entity has generated an id.'));
$this
->assertEqual($recurring_entity_load->commerce_recurring_ref_product[LANGUAGE_NONE][0]['target_id'], $recurring_entity->commerce_recurring_ref_product[LANGUAGE_NONE][0]['target_id'], t('Product values correctly set for the recurring entity saved.'));
$this
->assertEqual($recurring_entity_load->commerce_recurring_order[LANGUAGE_NONE][0]['target_id'], $recurring_entity->commerce_recurring_order[LANGUAGE_NONE][0]['target_id'], t('Order values correctly set for the recurring entity saved.'));
}