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