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