4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.4 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
20 | You should have received a copy of the GNU Affero General Public |
21 | License along with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Financial_FinancialAccountTest
extends CiviSeleniumTestCase
{
32 * Test To Add Financial Account class attributes.
34 function testFinancialAccount() {
35 $this->webtestLogin();
37 // Add new Financial Account
38 $orgName = 'Alberta '.substr(sha1(rand()), 0, 7);
39 $financialAccountTitle = 'Financial Account '.substr(sha1(rand()), 0, 4);
40 $financialAccountDescription = "{$financialAccountTitle} Description";
41 $accountingCode = 1033;
42 $financialAccountType = 'Expenses';
43 $taxDeductible = FALSE;
46 $taxRate = 9.99999999;
49 //Add new organisation
51 $this->webtestAddOrganization($orgName);
54 $this->_testAddFinancialAccount($financialAccountTitle,
55 $financialAccountDescription,
58 $financialAccountType,
66 $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']");
68 $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom');
69 //Varify Data after Adding new Financial Account
70 $verifyData = array('name' => $financialAccountTitle,
71 'description' => $financialAccountDescription,
72 'accounting_code' => $accountingCode,
73 'contact_name' => $orgName,
74 'tax_rate' => $taxRate,
76 'is_deductible' => 'off',
80 $this->_assertFinancialAccount($verifyData);
81 $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType);
82 $this->_assertSelectVerify($verifySelectFieldData);
83 $this->click('_qf_FinancialAccount_cancel-botttom');
85 //Edit Financial Account
86 $editfinancialAccount = $financialAccountTitle;
87 $financialAccountTitle .= ' Edited';
89 $financialAccountType = 'Revenue';
92 $orgNameEdit = 'NGO '.substr(sha1(rand()), 0, 7);
93 $this->webtestAddOrganization($orgNameEdit);
96 $this->_testEditFinancialAccount($editfinancialAccount,
97 $financialAccountTitle,
98 $financialAccountDescription,
101 $financialAccountType,
110 $orgName = $orgNameEdit;
112 $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']");
113 $this->clickLink("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom');
115 $verifyData = array( 'name' => $financialAccountTitle,
116 'description' => $financialAccountDescription,
117 'accounting_code' => $accountingCode,
118 'contact_name' => $orgName,
119 'tax_rate' => $taxRate,
121 'is_deductible' => 'off',
122 'is_default' => 'off',
124 $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType);
125 $this->_assertFinancialAccount($verifyData);
126 $this->_assertSelectVerify($verifySelectFieldData);
127 $this->click('_qf_FinancialAccount_cancel-botttom');
128 $this->waitForElementPresent("xpath=//table/tbody//tr/td[1][text()='{$financialAccountTitle}']/../td[9]/span/a[text()='Delete']");
130 //Delete Financial Account
131 $this->_testDeleteFinancialAccount($financialAccountTitle);