3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2014 |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
31 * Class WebTest_Contribute_UpdateContributionTest
33 class WebTest_Contribute_UpdateContributionTest
extends CiviSeleniumTestCase
{
35 protected function setUp() {
39 function testChangeContributionAmount() {
40 $this->webtestLogin();
41 $firstName = substr(sha1(rand()), 0, 7);
42 $lastName = 'Contributor';
43 $email = $firstName . "@example.com";
45 //Offline Pay Later Contribution
46 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
48 $this->openCiviPage("contribute/search", "reset=1", "contribution_date_low");
50 $this->type("sort_name", "$lastName, $firstName");
51 $this->click("_qf_Search_refresh");
53 $this->waitForElementPresent("xpath=//*[@id='Search']//div[@id='contributionSearch']");
54 $contriIDOff = explode('&', $this->getAttribute("xpath=//div[@id='contributionSearch']//table[@class='selector row-highlight']/tbody/tr[1]/td[11]/span/a[1]@href"));
55 if (!empty($contriIDOff)) {
56 $contriIDOff = substr($contriIDOff[1], (strrpos($contriIDOff[1], '=') +
1));
59 $this->clickLink("xpath=//tr[@id='rowid{$contriIDOff}']/td[11]/span/a[2]", "total_amount", FALSE);
60 $this->type("total_amount", "90");
61 $this->clickLink('_qf_Contribution_upload','',FALSE);
63 // Is status message correct?
64 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
67 $searchParams = array('id' => $contriIDOff);
68 $compareParams = array('total_amount' => '90.00');
70 $lineItemSearchParams = array('entity_id' => $contriIDOff);
71 $lineItemCompareParams = array('line_total' => '90.00');
73 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compareParams);
74 $this->assertDBCompareValues('CRM_Price_DAO_LineItem', $lineItemSearchParams, $lineItemCompareParams);
76 $total = $this->_getTotalContributedAmount($contriIDOff);
77 $compare = array('total_amount' => $total);
78 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
80 $amount = $this->_getFinancialItemAmount($contriIDOff);
81 $compare = array('total_amount' => $amount);
82 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
84 $financialTrxnAmount = $this->_getFinancialTrxnAmount($contriIDOff);
85 $compare = array('total_amount' => $financialTrxnAmount);
86 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $searchParams, $compare);
89 function testPayLater() {
90 $this->webtestLogin();
91 $firstName = substr(sha1(rand()), 0, 7);
92 $lastName = 'Contributor';
93 $email = $firstName . "@example.com";
95 //Offline Pay Later Contribution
96 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
97 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
98 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
99 $contId = explode('&', $contId[1]);
100 $contId = $contId[0];
101 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
102 $this->select("contribution_status_id", "label=Completed");
103 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
106 $search = array('id' => $contId);
107 $compare = array('contribution_status_id' => 1);
108 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
110 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
111 $search = array( 'entity_id' => $lineItem );
112 $compare = array( 'status_id' => 1 );
113 $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
115 $status = $this->_getPremiumActualCost($contId, 'Accounts Receivable', 'Payment Processor Account', NULL, "'civicrm_contribution'", "ft.status_id as status");
116 $this->assertEquals($status, '1', "Verify Completed Status");
119 function testChangePremium() {
120 $this->webtestLogin();
121 $firstName = substr(sha1(rand()), 0, 7);
122 $lastName = 'Contributor';
123 $email = $firstName . "@example.com";
125 $to = 'Premiums inventory';
126 $financialType = array(
127 'name' => 'Test Financial'.substr(sha1(rand()), 0, 7),
129 'is_deductible' => 1,
131 $this->addeditFinancialType($financialType);
132 $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
133 $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
134 $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
135 $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE);
136 $this->select("account_relationship", "label=Premiums Inventory Account is");
137 $this->select("financial_account_id", "label=$to");
138 $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE);
140 $premiumName = 'Premium'.substr(sha1(rand()), 0, 7);
145 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
147 $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
150 $premiumName2 = 'Premium'.substr(sha1(rand()), 0, 7);
155 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
156 $this->addPremium($premiumName2, $sku2, $amount2, $price2, $cost2, $financialType['name']);
158 // add contribution with premium
159 $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
161 // create new contact using dialog
162 $this->webtestNewDialogContact($firstName, $lastName, $email);
163 // select financial type
164 $this->select( "financial_type_id", "value=1" );
166 $this->type("total_amount", "100");
167 // fill Premium information
168 $this->clickLink("xpath=//div[@id='Premium']", "product_name_0", FALSE);
169 $this->select('product_name_0', "label=$premiumName ( $sku )");
171 $this->clickLink("_qf_Contribution_upload");
172 // Is status message correct?
173 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
174 // verify if Membership is created
175 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
176 //click through to the Contribution edit screen
177 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
178 $contId = explode('&', $contId[1]);
179 $contId = $contId[0];
180 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE);
181 $this->waitForElementPresent("product_name_0");
182 $this->select('product_name_0', "label=$premiumName2 ( $sku2 )");
184 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']", FALSE);
187 $actualAmount = $this->_getPremiumActualCost($contId, $to, $from, $cost2, "'civicrm_contribution'");
188 $this->assertEquals($actualAmount, $cost2, "Verify actual cost for changed premium");
190 $deletedAmount = $this->_getPremiumActualCost($contId, $from, $to, $cost, "'civicrm_contribution'");
191 $this->assertEquals($deletedAmount, $cost, "Verify actual cost for deleted premium");
194 function testDeletePremium() {
195 $this->webtestLogin();
196 $firstName = substr(sha1(rand()), 0, 7);
197 $lastName = 'Contributor';
198 $email = $firstName . "@example.com";
200 $to = 'Premiums inventory';
201 $financialType = array(
202 'name' => 'Test Financial' . substr(sha1(rand()), 0, 7),
204 'is_deductible' => 1,
206 $this->addeditFinancialType($financialType);
207 $this->waitForElementPresent("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
208 $this->click("xpath=//div[@id='ltype']/div/table/tbody//tr/td[text()='".$financialType['name']."']/../td[7]/span/a[text()='Accounts']");
209 $this->waitForElementPresent("xpath=//a[@id='newfinancialTypeAccount']");
210 $this->clickLink("xpath=//a[@id='newfinancialTypeAccount']", "_qf_FinancialTypeAccount_cancel-botttom", FALSE);
212 $this->select("account_relationship", "label=Premiums Inventory Account is");
213 $this->select("financial_account_id", "label=$to");
214 $this->clickLink("_qf_FinancialTypeAccount_next-botttom", "xpath=//a[@id='newfinancialTypeAccount']", FALSE);
215 $premiumName = 'Premium' . substr(sha1(rand()), 0, 7);
220 $this->openCiviPage("admin/contribute/managePremiums", "action=add&reset=1");
222 $this->addPremium($premiumName, $sku, $amount, $price, $cost, $financialType['name']);
224 // add contribution with premium
225 $this->openCiviPage("contribute/add", "reset=1&action=add&context=standalone");
227 // create new contact using dialog
228 $this->webtestNewDialogContact($firstName, $lastName, $email);
229 // select financial type
230 $this->select("financial_type_id", "value=1");
232 $this->type("total_amount", "100");
233 // fill Premium information
234 $this->click("xpath=//div[@id='Premium']");
235 $this->waitForElementPresent("product_name_0");
236 $this->select('product_name_0', "label=$premiumName ( $sku )");
238 $this->clickLink("_qf_Contribution_upload");
239 // Is status message correct?
240 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
241 // verify if Membership is created
242 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
243 //click through to the Contribution edit screen
244 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
245 $contId = explode('&', $contId[1]);
246 $contId = $contId[0];
247 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", "_qf_Contribution_upload-bottom", FALSE);
248 $this->waitForElementPresent("product_name_0");
249 $this->select('product_name_0', "value=0");
251 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']", FALSE);
254 $actualAmount = $this->_getPremiumActualCost($contId, $from, $to, NULL, "'civicrm_contribution'");
255 $this->assertEquals($actualAmount, $cost, "Verify actual cost for deleted premium");
258 function testChangePaymentInstrument() {
259 $this->webtestLogin();
260 $firstName = substr(sha1(rand()), 0, 7);
261 $lastName = 'Contributor';
262 $email = $firstName . "@example.com";
263 $label = 'TEST'.substr(sha1(rand()), 0, 7);
265 $financialAccount = CRM_Contribute_PseudoConstant
::financialAccount();
266 $to = array_search('Accounts Receivable', $financialAccount);
267 $from = array_search('Deposit Bank Account', $financialAccount);
268 $this->addPaymentInstrument($label, $to);
269 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
270 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
271 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
272 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
273 $contId = explode('&', $contId[1]);
274 $contId = $contId[0];
275 //change payment processor to newly created value
276 $this->select("payment_instrument_id", "label=$label");
277 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
279 $totalAmount = $this->_getPremiumActualCost($contId, 'Payment Processor Account', 'Accounts Receivable');
280 $this->assertEquals($totalAmount, $amount, "Verify amount for newly inserted values");
283 function testRefundContribution() {
284 $this->webtestLogin();
285 $firstName = substr(sha1(rand()), 0, 7);
286 $lastName = 'Contributor';
287 $email = $firstName . "@example.com";
288 $label = 'TEST'.substr(sha1(rand()), 0, 7);
290 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
291 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
292 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
293 //Contribution status
294 $this->select("contribution_status_id", "label=Refunded");
295 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
296 $contId = explode('&', $contId[1]);
297 $contId = $contId[0];
298 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
301 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
302 $search = array('entity_id' => $lineItem);
304 'amount' => '100.00',
307 $this->assertDBCompareValues("CRM_Financial_DAO_FinancialItem", $search, $compare);
308 $amount = $this->_getPremiumActualCost($contId, NULL, 'Payment Processor Account', -100.00, "'civicrm_contribution'");
309 $this->assertEquals($amount, '-100.00', 'Verify Financial Trxn Amount.');
312 function testCancelPayLater() {
313 $this->webtestLogin();
314 $firstName = substr(sha1(rand()), 0, 7);
315 $lastName = 'Contributor';
316 $email = $firstName . "@example.com";
317 $label = 'TEST'.substr(sha1(rand()), 0, 7);
319 $this->_testOfflineContribution($firstName, $lastName, $email, $amount, "Pending");
320 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
321 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
322 //Contribution status
323 $this->select("contribution_status_id", "label=Cancelled");
324 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
325 $contId = explode('&', $contId[1]);
326 $contId = $contId[0];
327 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
330 $search = array('id' => $contId);
331 $compare = array('contribution_status_id' => 3);
332 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
333 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
335 'amount' => '-100.00',
336 'entity_id' => $lineItem,
339 $items = CRM_Financial_BAO_FinancialItem
::retrieve($itemParams, $defaults);
340 $this->assertEquals($items->amount
, $itemParams['amount'], 'Verify Amount for financial Item');
341 $totalAmount = $this->_getPremiumActualCost($items->id
, 'Accounts Receivable', NULL, "-100.00", "'civicrm_financial_item'");
342 $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
343 $totalAmount = $this->_getPremiumActualCost($contId, 'Accounts Receivable', NULL, "-100.00", "'civicrm_contribution'");
344 $this->assertEquals($totalAmount, "-$amount", 'Verify Amount for Financial Trxn');
347 function testChangeFinancialType() {
348 $this->webtestLogin();
349 $firstName = substr(sha1(rand()), 0, 7);
350 $lastName = 'Contributor';
351 $email = $firstName . "@example.com";
352 $label = 'TEST'.substr(sha1(rand()), 0, 7);
354 $this->_testOfflineContribution($firstName, $lastName, $email, $amount);
355 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']");
356 $this->clickLink("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", '_qf_Contribution_cancel-bottom', FALSE);
357 //Contribution status
358 $this->select("financial_type_id", "value=3");
359 $contId = explode('&id=', $this->getAttribute("xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']@href"));
360 $contId = explode('&', $contId[1]);
361 $contId = $contId[0];
362 $this->clickLink("_qf_Contribution_upload", "xpath=//div[@class='view-content']//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='Edit']", FALSE);
365 $search = array( 'id' => $contId );
366 $compare = array( 'financial_type_id' => 3 );
367 $this->assertDBCompareValues('CRM_Contribute_DAO_Contribution', $search, $compare);
369 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
371 'amount' => '-100.00',
372 'entity_id' => $lineItem,
374 $item1 = $item2 = array();
375 CRM_Financial_BAO_FinancialItem
::retrieve($itemParams, $item1);
376 $this->assertEquals($item1['amount'], "-100.00", "Verify Amount for New Financial Item");
377 $itemParams['amount'] = '100.00';
378 CRM_Financial_BAO_FinancialItem
::retrieve($itemParams, $item2);
379 $this->assertEquals($item2['amount'], "100.00", "Verify Amount for New Financial Item");
381 $cValue1 = $this->_getPremiumActualCost($contId, NULL, NULL, "-100.00", "'civicrm_contribution'");
382 $fValue1 = $this->_getPremiumActualCost($item1['id'], NULL, NULL, "-100.00", "'civicrm_financial_item'");
383 $this->assertEquals($cValue1, "-100.00", "Verify Amount");
384 $this->assertEquals($fValue1, "-100.00", "Verify Amount");
385 $cValue2 = $this->_getPremiumActualCost($contId, NULL, NULL, "100.00", "'civicrm_contribution'");
386 $fValue2 = $this->_getPremiumActualCost($item2['id'], NULL, NULL, "100.00", "'civicrm_financial_item'");
387 $this->assertEquals($cValue2, "100.00", "Verify Amount");
388 $this->assertEquals($fValue2, "100.00", "Verify Amount");
396 * @param null $entityTable
397 * @param string $select
399 * @return null|string
400 */function _getPremiumActualCost($entityId, $from = NULL, $to = NULL, $cost = NULL, $entityTable = NULL, $select = "ft.total_amount AS amount") {
401 $financialAccount = CRM_Contribute_PseudoConstant
::financialAccount();
404 FROM civicrm_financial_trxn ft
405 INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_id = {$entityId}";
407 $query .= " AND eft.entity_table = {$entityTable}";
410 $to = array_search($to, $financialAccount);
411 $query .= " AND ft.to_financial_account_id = {$to}";
414 $from = array_search($from, $financialAccount);
415 $query .= " AND ft.from_financial_account_id = {$from}";
418 $query .= " AND eft.amount = {$cost}";
420 $result = CRM_Core_DAO
::singleValueQuery($query);
427 * @return null|string
428 */function _getFinancialTrxnAmount($contId) {
430 SUM( ft.total_amount ) AS total
431 FROM civicrm_financial_trxn AS ft
432 LEFT JOIN civicrm_entity_financial_trxn AS ceft ON ft.id = ceft.financial_trxn_id
433 WHERE ceft.entity_table = 'civicrm_contribution'
434 AND ceft.entity_id = {$contId}";
435 $result = CRM_Core_DAO
::singleValueQuery($query);
442 * @return null|string
443 */function _getFinancialItemAmount($contId) {
444 $lineItem = key(CRM_Price_BAO_LineItem
::getLineItems($contId, 'contribution'));
447 FROM civicrm_financial_item
448 WHERE entity_table = 'civicrm_line_item'
449 AND entity_id = {$lineItem}";
450 $result = CRM_Core_DAO
::singleValueQuery($query);
457 * @return null|string
458 */function _getTotalContributedAmount($contId) {
461 FROM civicrm_entity_financial_trxn
462 WHERE entity_table = 'civicrm_contribution'
463 AND entity_id = {$contId}";
464 $result = CRM_Core_DAO
::singleValueQuery($query);
473 * @param string $status
475 function _testOfflineContribution($firstName, $lastName, $email, $amount, $status="Completed") {
477 $this->openCiviPage("contribute/add", "reset=1&context=standalone", "_qf_Contribution_upload");
479 // create new contact using dialog
480 $this->webtestNewDialogContact($firstName, $lastName, $email);
482 // select financial type
483 $this->select( "financial_type_id", "value=1" );
485 //Contribution status
486 $this->select("contribution_status_id", "label=$status");
489 $this->type("total_amount", $amount);
491 // select payment instrument type
492 $this->select("payment_instrument_id", "label=Credit Card");
495 $this->type("trxn_id", "P20901X1" . rand(100, 10000));
499 //$this->click('CIVICRM_QFID_3_6');
502 $this->clickLink("_qf_Contribution_upload");
504 // Is status message correct?
505 $this->waitForText('crm-notification-container', "The contribution record has been saved.");
507 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[8]/span/a[text()='View']");
508 // verify if Membership is created
510 //click through to the Membership view screen
511 $this->click("xpath=//table[@class='selector row-highlight']/tbody/tr[1]/td[8]/span/a[text()='View']");
514 'Financial Type' => 'Donation',
515 'Total Amount' => '100.00',
516 'Contribution Status' => $status,
518 $this->webtestVerifyTabularData($expected);
519 $this->click("_qf_ContributionView_cancel-bottom");