$this->assertEquals($financialTrxn['total_amount'], 8000, 'Invalid Tax amount.');
}
+ /**
+ * Test for function getSalesTaxFinancialAccounts().
+ */
+ public function testgetSalesTaxFinancialAccounts() {
+ $this->enableTaxAndInvoicing();
+ $financialType = $this->createFinancialType();
+ $financialAccount = $this->relationForFinancialTypeWithFinancialAccount($financialType['id']);
+ $expectedResult = array($financialAccount->financial_account_id => $financialAccount->financial_account_id);
+ $financialType = $this->createFinancialType();
+ $financialAccount = $this->relationForFinancialTypeWithFinancialAccount($financialType['id']);
+ $expectedResult[$financialAccount->financial_account_id] = $financialAccount->financial_account_id;
+ $salesTaxFinancialAccount = CRM_Contribute_BAO_Contribution::getSalesTaxFinancialAccounts();
+ $this->assertTrue(($salesTaxFinancialAccount == $expectedResult), 'Function returned wrong values.');
+ }
+
}
}
}
+ /**
+ * Create Financial Type.
+ *
+ * @param array $params
+ *
+ * @return array
+ */
+ protected function createFinancialType($params = array()) {
+ $params = array_merge($params,
+ array(
+ 'name' => 'Financial-Type -' . substr(sha1(rand()), 0, 7),
+ 'is_active' => 1,
+ )
+ );
+ return $this->callAPISuccess('FinancialType', 'create', $params);
+ }
+
/**
* Enable Tax and Invoicing
*/