From b391ead9eeb657975fdc1e92b229a05b2fa0ea8a Mon Sep 17 00:00:00 2001 From: Edsel Date: Mon, 29 Feb 2016 19:42:49 +0530 Subject: [PATCH] CRM-16526 Added more unit tests for financial acl ---------------------------------------- * CRM-16526: ACLs for Financial Types https://issues.civicrm.org/jira/browse/CRM-16526 --- .../CRM/Financial/BAO/FinancialTypeTest.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php index 7ae71ae9ae..7d70849310 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php @@ -317,4 +317,24 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { $this->assertEquals($isACL, array('acl_financial_type' => 1)); } + /** + * Check method testisACLFinancialTypeStatus() + */ + public function testbuildPermissionedClause() { + $this->setACL(); + $config = &CRM_Core_Config::singleton(); + $config->userPermissionClass->permissions = array( + 'view contributions of type Donation', + 'view contributions of type Member Dues', + ); + CRM_Financial_BAO_FinancialType::buildPermissionedClause($whereClause, 'contribution'); + $this->assertEquals($whereClause, ' civicrm_contribution.financial_type_id IN (1,2)'); + $config->userPermissionClass->permissions[] = 'view contributions of type Event Fee'; + $whereClause = NULL; + CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = array(); + CRM_Financial_BAO_FinancialType::buildPermissionedClause($whereClause, 'contribution'); + $this->assertEquals($whereClause, ' civicrm_contribution.financial_type_id IN (1,4,2)'); + + } + } -- 2.25.1