Merge remote-tracking branch 'origin/4.5' into 4.5-master-2015-02-24-17-24-05
[civicrm-core.git] / tests / phpunit / WebTest / Grant / StandaloneAddTest.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
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 +--------------------------------------------------------------------+
d25dd0ee 25 */
6a488035 26
6a488035 27require_once 'CiviTest/CiviSeleniumTestCase.php';
e9479dcf
EM
28
29/**
30 * Class WebTest_Grant_StandaloneAddTest
31 */
6a488035
TO
32class WebTest_Grant_StandaloneAddTest extends CiviSeleniumTestCase {
33
6a488035
TO
34 protected function setUp() {
35 parent::setUp();
36 }
37
00be9182 38 public 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
80f3b91d 55 $contact = $this->createDialogContact();
6a488035
TO
56
57 // select grant Status
58 $this->select("status_id", "value=1");
59
60 // select grant type
61 $this->select("grant_type_id", "value=1");
62
63 // total amount
64 $this->type("amount_total", "100");
65
66 // amount requested
67 $this->type("amount_requested", "100");
68
69 // amount granted
70 $this->type("amount_granted", "90");
71
72 // fill in application received Date
73 $this->webtestFillDate('application_received_date');
74
75 // fill in decision Date
76 $this->webtestFillDate('decision_date');
77
78 // fill in money transfered date
79 $this->webtestFillDate('money_transfer_date');
80
81 // fill in grant due Date
82 $this->webtestFillDate('grant_due_date');
83
84 // check grant report recieved.
85 $this->check("grant_report_received");
86
87 // grant note
88 $this->type("note", "Grant Note");
89
90 // Clicking save.
45fabf8e 91 $this->clickLink("_qf_Grant_upload", "xpath=//div[@class='view-content']//table//tbody/tr[1]/td[8]/span/a[text()='View']", FALSE);
6a488035
TO
92
93 //click through to the Grant view screen
45fabf8e 94 $this->click("xpath=//div[@class='view-content']//table/tbody/tr[1]/td[8]/span/a[text()='View']");
6a488035
TO
95
96 $this->waitForElementPresent("_qf_GrantView_cancel-bottom");
97
98 $expected = array(
79d6583c
RN
99 'Grant Status' => 'Submitted',
100 'Grant Type' => 'Emergency',
101 'Amount Requested' => '$ 100.00',
102 'Amount Granted' => '$ 90.00',
103 'Notes' => 'Grant Note',
6a488035
TO
104 );
105
79d6583c 106 $this->webtestVerifyTabularData($expected);
6a488035 107 }
96025800 108
6a488035 109}