CRM-16189, fixed unit test
authorPradeep Nayak <pradpnayak@gmail.com>
Tue, 12 Jul 2016 15:31:37 +0000 (21:01 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Tue, 12 Jul 2016 15:31:37 +0000 (21:01 +0530)
----------------------------------------
* CRM-16189:
  https://issues.civicrm.org/jira/browse/CRM-16189

tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php

index 24372ebcac4bf3a9ff5832438284b1454e529bc3..f44e1aae583aa1b5b46212b1a33ad2094450a97f 100644 (file)
@@ -264,6 +264,7 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
               'qty' => 1,
               'unit_price' => 100,
               'line_total' => 100,
+              'financial_type_id' => 4,
             ),
             array(
               'entity_table' => 'civicrm_contribution',
@@ -273,14 +274,22 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase {
               'qty' => 1,
               'unit_price' => 200,
               'line_total' => 200,
+              'financial_type_id' => 4,
             ),
           ),
-          'params' => array(),
         ),
       ),
     );
-    $contribution = CRM_Contribute_BAO_Contribution::create($params);
-    $valid = CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params, $contribution->id);
+    $valid = CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params);
+    $this->assertFalse($valid, "This should have been false");
+    $params = array(
+      'contact_id' => $cid,
+      'receive_date' => '2016-01-20',
+      'total_amount' => 100,
+      'financial_type_id' => 1,
+      'revenue_recognition_date' => date('Ymd', strtotime("+1 month")),
+    );
+    $valid = CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params);
     $this->assertTrue($valid, "This should have been true.");
   }