3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License along with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
27 require_once 'CiviTest/CiviSeleniumTestCase.php';
30 * Class WebTest_Financial_FinancialAccountTest
32 class WebTest_Financial_FinancialAccountTest
extends CiviSeleniumTestCase
{
35 * Test To Add Financial Account class attributes.
37 public function testFinancialAccount() {
38 $this->webtestLogin();
40 // Add new Financial Account
41 $orgName = 'Alberta ' . substr(sha1(rand()), 0, 7);
42 $uniqueName = explode(" ", $orgName);
43 $financialAccountTitle = 'Financial Account ' . substr(sha1(rand()), 0, 4);
44 $financialAccountDescription = "{$financialAccountTitle} Description";
45 $accountingCode = 1033;
46 $financialAccountType = 'Liability';
47 $taxDeductible = FALSE;
50 $taxRate = 9.99999999;
53 //Add new organisation
55 $this->webtestAddOrganization($orgName);
58 $this->_testAddFinancialAccount($financialAccountTitle,
59 $financialAccountDescription,
62 $financialAccountType,
70 $this->waitForElementPresent("xpath=//table/tbody//tr/td[1]/div[text()='{$financialAccountTitle}']/../../td[9]/span/a[text()='Edit']");
72 $this->clickLink("xpath=//table/tbody//tr/td[1]/div[text()='{$financialAccountTitle}']/../../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom', FALSE);
73 //Varify Data after Adding new Financial Account
75 'name' => $financialAccountTitle,
76 'description' => $financialAccountDescription,
77 'accounting_code' => $accountingCode,
78 'tax_rate' => $taxRate,
80 'is_deductible' => 'off',
81 'is_default' => 'off',
84 $this->assertEquals($orgName, $this->getText("xpath=//*[@id='s2id_contact_id']/a/span[1]"));
86 $this->_assertFinancialAccount($verifyData);
87 $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType);
88 $this->_assertSelectVerify($verifySelectFieldData);
89 $this->click('_qf_FinancialAccount_cancel-botttom');
91 //Edit Financial Account
92 $editfinancialAccount = $financialAccountTitle;
93 $financialAccountTitle .= ' Edited';
95 $financialAccountType = 'Liability';
98 $orgNameEdit = 'NGO ' . substr(sha1(rand()), 0, 7);
99 $this->webtestAddOrganization($orgNameEdit);
100 $uniqueName = explode(" ", $orgNameEdit);
103 $this->_testEditFinancialAccount($editfinancialAccount,
104 $financialAccountTitle,
105 $financialAccountDescription,
108 $financialAccountType,
117 $orgName = $orgNameEdit;
119 $this->waitForElementPresent("xpath=//table/tbody//tr/td[1]/div[text()='{$financialAccountTitle}']/../../td[9]/span/a[text()='Edit']");
120 $this->clickLink("xpath=//table/tbody//tr/td[1]/div[text()='{$financialAccountTitle}']/../../td[9]/span/a[text()='Edit']", '_qf_FinancialAccount_cancel-botttom', FALSE);
123 'name' => $financialAccountTitle,
124 'description' => $financialAccountDescription,
125 'accounting_code' => $accountingCode,
126 'tax_rate' => $taxRate,
128 'is_deductible' => 'off',
129 'is_default' => 'off',
132 $this->assertEquals($orgName, $this->getText("xpath=//*[@id='s2id_contact_id']/a/span[1]"));
134 $this->_assertFinancialAccount($verifyData);
135 $verifySelectFieldData = array('financial_account_type_id' => $financialAccountType);
136 $this->_assertSelectVerify($verifySelectFieldData);
137 $this->click('_qf_FinancialAccount_cancel-botttom');
138 $this->waitForElementPresent("xpath=//table/tbody//tr/td[1]/div[text()='{$financialAccountTitle}']/../../td[9]/span/a[text()='Delete']");
140 //Delete Financial Account
141 $this->_testDeleteFinancialAccount($financialAccountTitle);