3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviSeleniumTestCase.php';
29 class WebTest_Member_StandaloneAddTest
extends CiviSeleniumTestCase
{
31 protected function setUp() {
35 function testStandaloneMemberAdd() {
37 $this->webtestLogin();
40 $firstName = substr(sha1(rand()), 0, 7);
41 $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name");
42 $contactName = "Memberson, $firstName";
44 // add membership type
45 $membershipTypes = $this->webtestAddMembershipType();
48 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
51 $this->webtestFillAutocomplete($firstName);
53 // fill in Membership Organization
54 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
56 // select membership type
57 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
60 $this->type("source", "Membership StandaloneAddTest Webtest");
62 // Let Join Date stay default
65 $this->webtestFillDate('start_date');
67 // Let End Date be auto computed
69 // fill in Status Override?
70 // fill in Record Membership Payment?
72 $this->click("_qf_Membership_upload");
75 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
76 $this->click("xpath=//div[@id='memberships']//table/tbody/tr[1]/td[9]/span/a[text()='View']");
77 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
80 'Membership Type' => $membershipTypes['membership_type'],
82 'Source' => 'Membership StandaloneAddTest Webtest',
84 $this->webtestVerifyTabularData($expected);
87 function testStandaloneMemberOverrideAdd() {
89 $this->webtestLogin();
92 $firstName = substr(sha1(rand()), 0, 7);
93 $this->webtestAddContact($firstName, "Memberson", "Memberson{$firstName}@memberson.name");
94 $contactName = "Memberson, $firstName";
96 // add membership type
97 $membershipTypes = $this->webtestAddMembershipType();
100 $this->openCiviPage("member/add", "reset=1&action=add&context=standalone", "_qf_Membership_upload");
103 $this->webtestFillAutocomplete($firstName);
105 // fill in Membership Organization
106 $this->select("membership_type_id[0]", "label={$membershipTypes['member_of_contact']}");
108 // select membership type
109 $this->select("membership_type_id[1]", "label={$membershipTypes['membership_type']}");
112 $this->type("source", "Membership StandaloneAddTest Webtest");
114 // Let Join Date stay default
116 // fill in Start Date
117 $this->webtestFillDate('start_date');
119 // Let End Date be auto computed
121 // fill in Status Override?
122 $this->click("is_override", "value=1");
123 $this->waitForElementPresent("status_id");
124 $this->select("status_id", "value=3");
126 // fill in Record Membership Payment?
127 $this->click("record_contribution", "value=1");
128 $this->waitForElementPresent("contribution_status_id");
129 // let financial type be default
131 // let the amount be default
133 // select payment instrument type = Check and enter chk number
134 $this->select("payment_instrument_id", "value=4");
135 $this->waitForElementPresent("check_number");
136 $this->type("check_number", "check #12345");
137 $this->type("trxn_id", "P5476785" . rand(100, 10000));
139 // fill the payment status be default
140 $this->select("contribution_status_id", "value=2");
145 $this->click("_qf_Membership_upload");
146 $this->waitForPageToLoad($this->getTimeoutMsec());
149 $this->waitForTextPresent("Membership StandaloneAddTest Webtest");
151 // verify if Membership is created
152 $this->waitForElementPresent("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
154 //click through to the Membership view screen
155 $this->click("xpath=//div[@id='memberships']//table//tbody/tr[1]/td[9]/span/a[text()='View']");
156 $this->waitForElementPresent("_qf_MembershipView_cancel-bottom");
159 'Membership Type' => $membershipTypes['membership_type'],
161 'Source' => 'Membership StandaloneAddTest Webtest',
163 $this->webtestVerifyTabularData($expected);