From c9a5a6e26bf037c74c46aebb5b2edb4726a8e796 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Tue, 12 Jul 2016 21:01:37 +0530 Subject: [PATCH] CRM-16189, fixed unit test ---------------------------------------- * CRM-16189: https://issues.civicrm.org/jira/browse/CRM-16189 --- .../CRM/Financial/BAO/FinancialAccountTest.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php index 24372ebcac..f44e1aae58 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php @@ -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."); } -- 2.25.1