Ian province abbreviation patch - issue 724
[civicrm-core.git] / tests / phpunit / WebTest / Pledge / StandaloneAddTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
81621fee 4 | CiviCRM version 4.7 |
6a488035 5 +--------------------------------------------------------------------+
e7112fa7 6 | Copyright CiviCRM LLC (c) 2004-2015 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
d25dd0ee 25 */
6a488035 26
6a488035 27require_once 'CiviTest/CiviSeleniumTestCase.php';
e9479dcf
EM
28
29/**
30 * Class WebTest_Pledge_StandaloneAddTest
31 */
6a488035
TO
32class WebTest_Pledge_StandaloneAddTest extends CiviSeleniumTestCase {
33
34 protected function setUp() {
35 parent::setUp();
36 }
37
7fe37828
EM
38 /**
39 * @return array
40 */
00be9182 41 public function testStandalonePledgeAdd() {
6a488035
TO
42 $this->webtestLogin();
43
d2771e94 44 $this->openCiviPage('pledge/add', 'reset=1&context=standalone', '_qf_Pledge_upload');
6a488035
TO
45
46 // create new contact using dialog
80f3b91d 47 $contact = $this->createDialogContact();
6a488035
TO
48
49 $this->type('amount', '100');
50 $this->type('installments', '10');
51 $this->select('frequency_unit', 'value=week');
52 $this->type('frequency_day', '2');
53
54 $this->webtestFillDate('acknowledge_date', 'now');
55
56 $this->select('contribution_page_id', 'value=3');
57
6a488035
TO
58 //PaymentReminders
59 $this->click('PaymentReminders');
60 $this->waitForElementPresent('additional_reminder_day');
61 $this->type('initial_reminder_day', '4');
62 $this->type('max_reminders', '2');
63 $this->type('additional_reminder_day', '4');
64
65 $this->click('_qf_Pledge_upload-bottom');
6a488035 66
6c5f7368 67 $this->waitForText('crm-notification-container', "Pledge has been recorded and the payment schedule has been created.");
6a488035
TO
68
69 // verify if Pledge is created
45fabf8e 70 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035
TO
71
72 //click through to the Pledge view screen
45fabf8e 73 $this->click("xpath=//div[@class='view-content']//table//tbody/tr[1]/td[10]/span/a[text()='View']");
6a488035
TO
74 $this->waitForElementPresent('_qf_PledgeView_next-bottom');
75 $pledgeDate = date('F jS, Y', strtotime('now'));
76
77 $this->webtestVerifyTabularData(array(
80f3b91d 78 'Pledge By' => $contact['display_name'],
6a488035
TO
79 'Total Pledge Amount' => '$ 100.00',
80 'To be paid in' => '10 installments of $ 10.00 every 1 week(s)',
81 'Payments are due on the' => '2 day of the period',
82 'Pledge Made' => $pledgeDate,
83 'Financial Type' => 'Donation',
84 'Pledge Status' => 'Pending',
6a488035
TO
85 'Initial Reminder Day' => '4 days prior to schedule date',
86 'Maximum Reminders Send' => 2,
87 'Send additional reminders' => '4 days after the last one sent',
88 )
89 );
08f17a9f
RK
90 $this->clickLink('_qf_PledgeView_next-bottom', "xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a", FALSE);
91 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
92 $this->waitForAjaxContent();
93 $this->click("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span/a");
94 $this->waitForElementPresent("xpath=//div[@class='view-content']//table[@class='selector row-highlight']//tbody/tr[1]/td[1]/span[2]/a");
95 $this->waitForElementPresent("xpath=//div[@class='view-content']//table//tbody/tr[2]/td[2]/table/tbody/tr[2]/td[8]/a[text()='Record Payment']");
e3c14a3a 96 return $contact;
6a488035 97 }
96025800 98
6a488035 99}