CRM-16526 CIVI-3 Fixed Jenkins test failure
authorEdsel <edsel.lopez@jmaconsulting.biz>
Tue, 8 Mar 2016 13:19:23 +0000 (18:49 +0530)
committerEdsel <edsel.lopez@jmaconsulting.biz>
Tue, 8 Mar 2016 13:19:23 +0000 (18:49 +0530)
----------------------------------------
* CRM-16526: ACLs for Financial Types
  https://issues.civicrm.org/jira/browse/CRM-16526

api/v3/Contribution.php
tests/phpunit/api/v3/FinancialTypeACLTest.php

index 6ab0c195e8bf30415535da11a50af87c87bfcca0..acc2f5887e29a15ce45627e8b495058613182fba 100644 (file)
@@ -52,10 +52,7 @@ function civicrm_api3_contribution_create(&$params) {
     }
     else {
       if (empty($params['financial_type_id'])) {
-        $params['financial_type_id'] = civicrm_api3('Contribution', 'getvalue', array(
-          'id' => $params['id'],
-          'return' => 'financial_type_id',
-        ));
+        $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $params['id'], 'financial_type_id');
       }
       $op = CRM_Core_Action::UPDATE;
     }
index d8b29c1e4afe35edfe1cfe533b1416119d9f33c0..c9ee3af7b2b8fd8542bb245d191229633f00c5c1 100644 (file)
@@ -116,7 +116,8 @@ class api_v3_FinancialTypeACLTest extends CiviUnitTestCase {
   }
 
   public function setACL() {
-    CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = NULL;
+    CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = array();
+    CRM_Financial_BAO_FinancialType::$_statusACLFt = array();
     $params = array(
       'domain_id' => 1,
       'contribution_invoice_settings' => array('acl_financial_type' => 1),
@@ -315,7 +316,7 @@ class api_v3_FinancialTypeACLTest extends CiviUnitTestCase {
     );
     $contribution = $this->callAPIFailure('Contribution', 'create', $params);
 
-    $config->userPermissionClass->permissions[3] = 'edit contributions of type Donation';
+    $config->userPermissionClass->permissions[] = 'edit contributions of type Donation';
     $contribution = $this->callAPISuccess('Contribution', 'create', $params);
 
     $this->assertEquals($contribution['values'][$contribution['id']]['total_amount'], 200.00);