Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
06a1bc01 | 4 | | CiviCRM version 4.5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
06a1bc01 | 6 | | Copyright CiviCRM LLC (c) 2004-2014 | |
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 | +--------------------------------------------------------------------+ | |
25 | */ | |
26 | ||
6a488035 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Grant_StandaloneAddTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase { |
33 | ||
6a488035 TO |
34 | protected function setUp() { |
35 | parent::setUp(); | |
36 | } | |
37 | ||
38 | function testStandaloneGrantAdd() { | |
6a488035 | 39 | // Log in as admin first to verify permissions for CiviGrant |
42daf119 | 40 | $this->webtestLogin('admin'); |
6a488035 TO |
41 | |
42 | // Enable CiviGrant module if necessary | |
b9715b8a | 43 | $this->enableComponents("CiviGrant"); |
6a488035 TO |
44 | |
45 | // let's give full CiviGrant permissions to demo user (registered user). | |
46 | $permission = array('edit-2-access-civigrant', 'edit-2-edit-grants', 'edit-2-delete-in-civigrant'); | |
47 | $this->changePermissions($permission); | |
48 | ||
42daf119 CW |
49 | // Log in as normal user |
50 | $this->webtestLogin(); | |
6a488035 | 51 | |
42daf119 | 52 | $this->openCiviPage('grant/add', 'reset=1&context=standalone', '_qf_Grant_upload'); |
6a488035 TO |
53 | |
54 | // create new contact using dialog | |
55 | $firstName = substr(sha1(rand()), 0, 7); | |
56 | $this->webtestNewDialogContact($firstName, "Grantor", $firstName . "@example.com"); | |
57 | ||
58 | // select grant Status | |
59 | $this->select("status_id", "value=1"); | |
60 | ||
61 | // select grant type | |
62 | $this->select("grant_type_id", "value=1"); | |
63 | ||
64 | // total amount | |
65 | $this->type("amount_total", "100"); | |
66 | ||
67 | // amount requested | |
68 | $this->type("amount_requested", "100"); | |
69 | ||
70 | // amount granted | |
71 | $this->type("amount_granted", "90"); | |
72 | ||
73 | // fill in application received Date | |
74 | $this->webtestFillDate('application_received_date'); | |
75 | ||
76 | // fill in decision Date | |
77 | $this->webtestFillDate('decision_date'); | |
78 | ||
79 | // fill in money transfered date | |
80 | $this->webtestFillDate('money_transfer_date'); | |
81 | ||
82 | // fill in grant due Date | |
83 | $this->webtestFillDate('grant_due_date'); | |
84 | ||
85 | // check grant report recieved. | |
86 | $this->check("grant_report_received"); | |
87 | ||
88 | // grant note | |
89 | $this->type("note", "Grant Note"); | |
90 | ||
91 | // Clicking save. | |
45fabf8e | 92 | $this->clickLink("_qf_Grant_upload", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[8]/span/a[text()='View']", FALSE); |
6a488035 TO |
93 | |
94 | //click through to the Grant view screen | |
45fabf8e | 95 | $this->click("xpath=//div[@class='view-content']//table/tbody/tr[1]/td[8]/span/a[text()='View']"); |
6a488035 TO |
96 | |
97 | $this->waitForElementPresent("_qf_GrantView_cancel-bottom"); | |
98 | ||
99 | $expected = array( | |
79d6583c RN |
100 | 'Grant Status' => 'Submitted', |
101 | 'Grant Type' => 'Emergency', | |
102 | 'Amount Requested' => '$ 100.00', | |
103 | 'Amount Granted' => '$ 90.00', | |
104 | 'Notes' => 'Grant Note', | |
6a488035 TO |
105 | ); |
106 | ||
79d6583c | 107 | $this->webtestVerifyTabularData($expected); |
6a488035 TO |
108 | } |
109 | } | |
110 |