From b09dd4ecae58ea299df5c6f0e9ffedba2ec162ca Mon Sep 17 00:00:00 2001
From: Christian Sieber <kazanir@gmail.com>
Date: Fri, 29 Aug 2014 01:56:38 +0200
Subject: [PATCH] Fixed tests to reflect appropriate expected quantity on gauge
 usage test

---
 commerce_license_billing.module     | 4 +++-
 tests/commerce_license_billing.test | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/commerce_license_billing.module b/commerce_license_billing.module
index 9b4bad7..818b607 100644
--- a/commerce_license_billing.module
+++ b/commerce_license_billing.module
@@ -911,7 +911,9 @@ function commerce_license_billing_collect_charges(CommerceLicenseInterface $lice
         $product_wrapper = entity_metadata_wrapper('commerce_product', $product);
 
         $charges[] = array(
-          'license_revision_id' => $usage_record['revision_id'],
+          // Not all usage records supply the revision ID of the license, as
+          //   is it not always relevant.
+          'license_revision_id' => (isset($usage_record['revision_id']) ? $usage_record['revision_id'] : NULL),
           'commerce_product' => $product,
           'quantity' => $usage_record['quantity'],
           'commerce_unit_price' => $product_wrapper->commerce_price->value(),
diff --git a/tests/commerce_license_billing.test b/tests/commerce_license_billing.test
index f63dfe3..9bb1803 100644
--- a/tests/commerce_license_billing.test
+++ b/tests/commerce_license_billing.test
@@ -506,7 +506,7 @@ class CommerceLicenseBillingTestCase extends CommerceBaseTestCase {
       'commerce_unit_price' => array(
         'amount' => '500', // 5$
       ),
-      'quantity' => 4,
+      'quantity' => 1,
       'cl_billing_start' => $plan_durations[1][0],
       'cl_billing_end' => $plan_durations[1][1],
     );
@@ -516,7 +516,7 @@ class CommerceLicenseBillingTestCase extends CommerceBaseTestCase {
       'commerce_unit_price' => array(
         'amount' => '125', // 1.25$
       ),
-      'quantity' => 4,
+      'quantity' => 1,
       'cl_billing_start' => $plan_durations[3][0],
       'cl_billing_end' => $this->billing_cycle->end,
     );
-- 
1.9.1

