From 871de167f7abae5fadec3cc69d30abd72d8b2af7 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 22 Jun 2016 15:12:48 +0530 Subject: [PATCH] CRM-16189, added full stop and used callAPISuccess() to create entries in db ---------------------------------------- * CRM-16189: Improve support for Accrual Method bookkeeping https://issues.civicrm.org/jira/browse/CRM-16189 Conflicts: CRM/Financial/BAO/FinancialAccount.php --- CRM/Financial/BAO/FinancialAccount.php | 4 ++-- .../CRM/Financial/BAO/FinancialAccountTest.php | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index defff9a1ba..64aa86879b 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -247,7 +247,7 @@ WHERE cft.id = %1 } /** - * Get Financial Account type relations + * Get Financial Account type relations. * * @param $flip bool * @@ -283,7 +283,7 @@ WHERE cft.id = %1 } /** - * Get Deferred Financial type + * Get Deferred Financial type. * * @return array * diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php index 424416f303..5f52bd7c44 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php @@ -227,27 +227,26 @@ class CRM_Financial_BAO_FinancialAccountTest extends CiviUnitTestCase { 'is_reserved' => 0, ); - $ids = array(); - $financialAccount = CRM_Financial_BAO_FinancialAccount::add($params, $ids); + $financialAccount = $this->callAPISuccess('FinancialAccount', 'create', $params); $params['name'] = 'test_financialType1'; - $financialType = CRM_Financial_BAO_FinancialType::add($params, $ids); + $financialType = $this->callAPISuccess('FinancialType', 'create', $params); $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Deferred Revenue Account is' ")); $financialParams = array( 'entity_table' => 'civicrm_financial_type', - 'entity_id' => $financialType->id, + 'entity_id' => $financialType['id'], 'account_relationship' => $relationTypeId, - 'financial_account_id' => $financialAccount->id, + 'financial_account_id' => $financialAccount['id'], ); - CRM_Financial_BAO_FinancialTypeAccount::add($financialParams, $ids); + $this->callAPISuccess('EntityFinancialAccount', 'create', $financialParams); $result = $this->assertDBNotNull( 'CRM_Financial_DAO_EntityFinancialAccount', - $financialAccount->id, + $financialAccount['id'], 'entity_id', 'financial_account_id', 'Database check on added financial type record.' ); - $this->assertEquals($result, $financialType->id, 'Verify Account Type'); + $this->assertEquals($result, $financialType['id'], 'Verify Account Type'); $financialTypes = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType(); $this->assertTrue(array_key_exists($result, $financialTypes), "The financial type created does not have a deferred account relationship"); } -- 2.25.1