Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
2fe49090 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
8c9251b3 | 6 | | Copyright CiviCRM LLC (c) 2004-2018 | |
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 | 27 | require_once 'CiviTest/CiviSeleniumTestCase.php'; |
e9479dcf EM |
28 | |
29 | /** | |
30 | * Class WebTest_Event_AddEventTest | |
31 | */ | |
6a488035 TO |
32 | class WebTest_Event_AddEventTest extends CiviSeleniumTestCase { |
33 | ||
34 | protected function setUp() { | |
35 | parent::setUp(); | |
36 | } | |
37 | ||
00be9182 | 38 | public function testAddPaidEventNoTemplate() { |
6a488035 TO |
39 | // Log in using webtestLogin() method |
40 | $this->webtestLogin(); | |
41 | ||
c3ad8633 CW |
42 | // Use default payment processor |
43 | $processorName = 'Test Processor'; | |
6a488035 TO |
44 | $this->webtestAddPaymentProcessor($processorName); |
45 | ||
071a6d2e | 46 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
47 | |
48 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
49 | $eventDescription = "Here is a description for this conference."; | |
50 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
51 | ||
52 | $streetAddress = "100 Main Street"; | |
53 | $this->_testAddLocation($streetAddress); | |
54 | ||
55 | $this->_testAddReminder($eventTitle); | |
56 | ||
57 | $this->_testAddFees(FALSE, FALSE, $processorName); | |
58 | ||
59 | // intro text for registration page | |
60 | $registerIntro = "Fill in all the fields below and click Continue."; | |
61 | $multipleRegistrations = TRUE; | |
62 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
63 | ||
64 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); | |
05f3c31c | 65 | $eventId = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); |
6a488035 TO |
66 | |
67 | $registerStrings = array("225.00", "Member", "300.00", "Non-member", $registerIntro); | |
68 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
69 | ||
70 | $numberRegistrations = 3; | |
71 | $anonymous = TRUE; | |
72 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous); | |
6712d671 | 73 | |
05f3c31c DG |
74 | // Now test making a copy of the event |
75 | $this->webtestLogin(); | |
76 | $this->openCiviPage("event/manage", "reset=1&action=copy&id=$eventId"); | |
6712d671 | 77 | $this->_testVerifyEventInfo('Copy of ' . $eventTitle, $eventInfoStrings); |
78 | $this->_testVerifyRegisterPage($registerStrings); | |
6a488035 TO |
79 | } |
80 | ||
00be9182 | 81 | public function testAddPaidEventDiscount() { |
6a488035 TO |
82 | |
83 | // Log in using webtestLogin() method | |
84 | $this->webtestLogin(); | |
85 | ||
c3ad8633 CW |
86 | // Use default payment processor |
87 | $processorName = 'Test Processor'; | |
6a488035 TO |
88 | $this->webtestAddPaymentProcessor($processorName); |
89 | ||
071a6d2e | 90 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
91 | |
92 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
93 | $eventDescription = "Here is a description for this conference."; | |
94 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
95 | ||
96 | $streetAddress = "100 Main Street"; | |
97 | $this->_testAddLocation($streetAddress); | |
98 | ||
99 | $this->_testAddReminder($eventTitle); | |
100 | ||
101 | $this->_testAddFees(TRUE, FALSE, $processorName); | |
102 | ||
103 | // intro text for registration page | |
104 | $registerIntro = "Fill in all the fields below and click Continue."; | |
105 | $multipleRegistrations = TRUE; | |
106 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
107 | ||
76e86fd8 CW |
108 | $discountFees = array("225.00", "300.00"); |
109 | ||
6a488035 TO |
110 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); |
111 | $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); | |
112 | ||
113 | $registerStrings = array_push($discountFees, "Member", "Non-member", $registerIntro); | |
114 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
115 | ||
116 | $numberRegistrations = 3; | |
117 | $anonymous = TRUE; | |
118 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous); | |
119 | } | |
120 | ||
00be9182 | 121 | public function testDeletePriceSetDiscount() { |
6a488035 TO |
122 | |
123 | // Log in using webtestLogin() method | |
124 | $this->webtestLogin(); | |
125 | ||
c3ad8633 CW |
126 | // Use default payment processor |
127 | $processorName = 'Test Processor'; | |
6a488035 TO |
128 | $this->webtestAddPaymentProcessor($processorName); |
129 | ||
071a6d2e | 130 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
131 | |
132 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
133 | $eventDescription = "Here is a description for this conference."; | |
134 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
135 | ||
136 | $streetAddress = "100 Main Street"; | |
137 | $this->_testAddLocation($streetAddress); | |
138 | ||
139 | //Add two discounts | |
140 | $discount = $this->_testAddFees(TRUE, FALSE, $processorName, TRUE); | |
141 | ||
142 | // intro text for registration page | |
143 | $registerIntro = "Fill in all the fields below and click Continue."; | |
144 | $multipleRegistrations = TRUE; | |
145 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
146 | ||
76e86fd8 CW |
147 | $discountFees = array("225.00", "300.00"); |
148 | ||
6a488035 TO |
149 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); |
150 | $id = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); | |
151 | ||
152 | $registerStrings = array_push($discountFees, "Member", "Non-member", $registerIntro); | |
153 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
154 | ||
155 | //Add Price Set now | |
42daf119 | 156 | $this->openCiviPage("event/manage/fee", "reset=1&action=update&id=$id", "_qf_Fee_upload-bottom"); |
6a488035 | 157 | $this->click("xpath=//a[@id='quickconfig']"); |
038f0330 | 158 | $this->waitForElementPresent("xpath=//div[@class='ui-dialog-buttonset']"); |
c494e713 | 159 | $this->click("xpath=//div[@class='ui-dialog-buttonset']//button/span[text()='Continue']"); |
76e86fd8 | 160 | |
6a488035 | 161 | //Assert quick config change and discount deletion |
071a6d2e | 162 | $this->openCiviPage("admin/price", "reset=1"); |
c494e713 RK |
163 | foreach ($discount as $key => $val) { |
164 | $this->waitForTextPresent($val); | |
165 | } | |
6a488035 TO |
166 | } |
167 | ||
00be9182 | 168 | public function testAddDeleteEventDiscount() { |
6a488035 TO |
169 | |
170 | // Log in using webtestLogin() method | |
171 | $this->webtestLogin(); | |
172 | ||
c3ad8633 CW |
173 | // Use default payment processor |
174 | $processorName = 'Test Processor'; | |
6a488035 TO |
175 | $this->webtestAddPaymentProcessor($processorName); |
176 | ||
071a6d2e | 177 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
178 | |
179 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
180 | $eventDescription = "Here is a description for this conference."; | |
181 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
182 | ||
183 | $streetAddress = "100 Main Street"; | |
184 | $this->_testAddLocation($streetAddress); | |
185 | ||
186 | //Add two discounts | |
187 | $discount = $this->_testAddFees(TRUE, FALSE, $processorName, TRUE); | |
188 | ||
189 | // intro text for registration page | |
190 | $registerIntro = "Fill in all the fields below and click Continue."; | |
191 | $multipleRegistrations = TRUE; | |
192 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
193 | ||
76e86fd8 CW |
194 | $discountFees = array("225.00", "300.00"); |
195 | ||
6a488035 TO |
196 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); |
197 | $id = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings, $discountFees); | |
198 | ||
199 | $registerStrings = array_push($discountFees, "Member", "Non-member", $registerIntro); | |
200 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
201 | //Delete the discount | |
202 | $this->_deleteDiscount($id, $eventTitle, $discount); | |
203 | } | |
204 | ||
4cbe18b8 | 205 | /** |
100fef9d | 206 | * @param int $id |
4cbe18b8 EM |
207 | * @param $eventTitle |
208 | * @param $discount | |
209 | */ | |
00be9182 | 210 | public function _deleteDiscount($id, $eventTitle, $discount) { |
42daf119 | 211 | $this->openCiviPage("event/manage/fee", "reset=1&action=update&id=$id", "_qf_Fee_upload-bottom"); |
6a488035 | 212 | $this->type("discount_name_2", ""); |
60709d21 JP |
213 | $this->click("xpath=//tr[@id='discount_2']/td[3]/a"); |
214 | $this->click("xpath=//tr[@id='discount_2']/td[4]/a"); | |
6a488035 TO |
215 | $this->type("discounted_value_1_2", ""); |
216 | $this->type("discounted_value_2_2", ""); | |
217 | $this->click("_qf_Fee_upload-bottom"); | |
60709d21 | 218 | $this->waitForText('crm-notification-container', "'Fees' information has been saved."); |
6a488035 | 219 | //Assertions |
071a6d2e | 220 | $this->openCiviPage("admin/price", "reset=1"); |
6a488035 TO |
221 | $this->assertStringsPresent($discount[1]); |
222 | } | |
223 | ||
00be9182 | 224 | public function testAddPaidEventWithTemplate() { |
6a488035 TO |
225 | |
226 | // Log in using webtestLogin() method | |
227 | $this->webtestLogin(); | |
228 | ||
c3ad8633 CW |
229 | // Use default payment processor |
230 | $processorName = 'Test Processor'; | |
6a488035 TO |
231 | $this->webtestAddPaymentProcessor($processorName); |
232 | ||
071a6d2e | 233 | $this->openCiviPage("event/add", "reset=1&action=add"); |
6a488035 TO |
234 | |
235 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
236 | $eventDescription = "Here is a description for this conference."; | |
237 | // Select paid online registration template. | |
238 | $templateID = 6; | |
239 | $eventTypeID = 1; | |
240 | $this->_testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID); | |
241 | ||
242 | $streetAddress = "100 Main Street"; | |
243 | $this->_testAddLocation($streetAddress); | |
244 | ||
245 | $this->_testAddFees(FALSE, FALSE, $processorName); | |
246 | ||
247 | // intro text for registration page | |
248 | $registerIntro = "Fill in all the fields below and click Continue."; | |
249 | $this->_testAddOnlineRegistration($registerIntro); | |
250 | ||
251 | // $eventInfoStrings = array( $eventTitle, $eventDescription, $streetAddress ); | |
252 | $eventInfoStrings = array($eventTitle, $streetAddress); | |
253 | $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); | |
254 | ||
255 | $registerStrings = array("225.00", "Member", "300.00", "Non-member", $registerIntro); | |
256 | $this->_testVerifyRegisterPage($registerStrings); | |
257 | } | |
258 | ||
00be9182 | 259 | public function testAddFreeEventWithTemplate() { |
6a488035 TO |
260 | |
261 | // Log in using webtestLogin() method | |
262 | $this->webtestLogin(); | |
42daf119 | 263 | |
071a6d2e | 264 | $this->openCiviPage("event/add", "reset=1&action=add"); |
76e86fd8 | 265 | |
6a488035 TO |
266 | $eventTitle = 'My Free Meeting - ' . substr(sha1(rand()), 0, 7); |
267 | $eventDescription = "Here is a description for this free meeting."; | |
268 | // Select "Free Meeting with Online Registration" template (id = 5). | |
269 | $templateID = 5; | |
76e86fd8 CW |
270 | $eventTypeID = 4; |
271 | ||
6a488035 | 272 | $this->_testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID); |
76e86fd8 CW |
273 | |
274 | $streetAddress = "100 Main Street"; | |
275 | ||
276 | $this->_testAddLocation($streetAddress); | |
6a488035 TO |
277 | |
278 | // Go to Fees tab and check that Paid Event is false (No) | |
279 | $this->click("link=Fees"); | |
280 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
281 | $this->verifyChecked("CIVICRM_QFID_0_is_monetary"); | |
282 | ||
283 | // intro text for registration page | |
284 | $registerIntro = "Fill in all the fields below and click Continue."; | |
285 | $this->_testAddOnlineRegistration($registerIntro); | |
286 | ||
287 | // $eventInfoStrings = array( $eventTitle, $eventDescription, $streetAddress ); | |
288 | $eventInfoStrings = array($eventTitle, $streetAddress); | |
289 | $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); | |
290 | ||
291 | $registerStrings = array($registerIntro); | |
292 | $this->_testVerifyRegisterPage($registerStrings); | |
293 | // make sure paid_event div is NOT present since this is a free event | |
294 | $this->verifyElementNotPresent("css=div.paid_event-section"); | |
295 | } | |
296 | ||
00be9182 | 297 | public function testUnpaidPaid() { |
f75b8467 | 298 | $this->markTestSkipped('Skipping for now as it works fine locally.'); |
0dce9149 PJ |
299 | // Log in using webtestLogin() method |
300 | $this->webtestLogin(); | |
301 | ||
071a6d2e | 302 | $this->openCiviPage("event/add", "reset=1&action=add"); |
0dce9149 PJ |
303 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); |
304 | $eventDescription = "Here is a description for this conference."; | |
305 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
306 | ||
307 | //add fee section with pay later checked | |
308 | $this->_testAddFees(FALSE, FALSE, NULL, FALSE, TRUE); | |
309 | ||
310 | //make the event unpaid | |
311 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
312 | $this->assertChecked('is_pay_later'); | |
313 | $this->click("CIVICRM_QFID_0_is_monetary"); | |
0dce9149 | 314 | |
50d95825 CW |
315 | $this->click("_qf_Fee_upload-bottom"); |
316 | $this->waitForText('crm-notification-container', "'Fees' information has been saved."); | |
317 | $this->waitForAjaxContent(); | |
3e60ff7f | 318 | |
0dce9149 PJ |
319 | //check if pay later option is disabled |
320 | $this->click('CIVICRM_QFID_1_is_monetary'); | |
a90dac23 | 321 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
0dce9149 PJ |
322 | $this->waitForElementPresent('is_pay_later'); |
323 | $this->assertNotChecked('is_pay_later'); | |
324 | } | |
325 | ||
00be9182 | 326 | public function testAjaxCustomGroupLoad() { |
c4e6d4e8 PJ |
327 | $this->webtestLogin(); |
328 | ||
329 | $triggerElement = array('name' => 'event_type_id', 'type' => 'select'); | |
330 | $customSets = array( | |
331 | array('entity' => 'Event', 'subEntity' => 'Conference', 'triggerElement' => $triggerElement), | |
332 | ); | |
333 | ||
334 | $pageUrl = array('url' => 'event/add', 'args' => "reset=1&action=add"); | |
335 | $this->customFieldSetLoadOnTheFlyCheck($customSets, $pageUrl); | |
336 | } | |
337 | ||
4cbe18b8 EM |
338 | /** |
339 | * @param $eventTitle | |
340 | * @param $eventDescription | |
341 | */ | |
00be9182 | 342 | public function _testAddEventInfo($eventTitle, $eventDescription) { |
6a488035 TO |
343 | $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); |
344 | ||
6a488035 TO |
345 | $this->select("event_type_id", "value=1"); |
346 | ||
347 | // Attendee role s/b selected now. | |
348 | $this->select("default_role_id", "value=1"); | |
349 | ||
350 | // Enter Event Title, Summary and Description | |
351 | $this->type("title", $eventTitle); | |
352 | $this->type("summary", "This is a great conference. Sign up now!"); | |
353 | ||
354 | // Type description in ckEditor (fieldname, text to type, editor) | |
355 | $this->fillRichTextField("description", $eventDescription, 'CKEditor'); | |
356 | ||
357 | // Choose Start and End dates. | |
358 | // Using helper webtestFillDate function. | |
359 | $this->webtestFillDateTime("start_date", "+1 week"); | |
360 | $this->webtestFillDateTime("end_date", "+1 week 1 day 8 hours "); | |
f852aaf4 | 361 | $this->waitForElementPresent('max_participants'); |
6a488035 TO |
362 | $this->type("max_participants", "50"); |
363 | $this->click("is_map"); | |
364 | $this->click("is_public"); | |
50d95825 | 365 | $this->clickLink("_qf_EventInfo_upload-bottom"); |
6a488035 TO |
366 | } |
367 | ||
4cbe18b8 EM |
368 | /** |
369 | * @param $eventTitle | |
370 | * @param $eventDescription | |
100fef9d CW |
371 | * @param int $templateID |
372 | * @param int $eventTypeID | |
4cbe18b8 | 373 | */ |
00be9182 | 374 | public function _testAddEventInfoFromTemplate($eventTitle, $eventDescription, $templateID, $eventTypeID) { |
6a488035 | 375 | $this->waitForElementPresent("_qf_EventInfo_upload-bottom"); |
42daf119 | 376 | |
6a488035 | 377 | // Select event template. Use option value, not label - since labels can be translated and test would fail |
76e86fd8 | 378 | $this->select("template_id", "value={$templateID}"); |
6a488035 | 379 | |
50d95825 CW |
380 | // Wait for event type to be filled in (since page refreshes) |
381 | $this->waitForAjaxContent(); | |
76e86fd8 | 382 | $this->verifySelectedValue("event_type_id", $eventTypeID); |
6a488035 TO |
383 | |
384 | // Attendee role s/b selected now. | |
385 | $this->verifySelectedValue("default_role_id", "1"); | |
76e86fd8 | 386 | |
6a488035 | 387 | // Enter Event Title, Summary and Description |
76e86fd8 CW |
388 | $this->type("title", $eventTitle); |
389 | ||
6a488035 TO |
390 | $this->type("summary", "This is a great conference. Sign up now!"); |
391 | ||
392 | // Type description in ckEditor (fieldname, text to type, editor) | |
393 | $this->fillRichTextField("description", $eventDescription, 'CKEditor'); | |
394 | ||
395 | // Choose Start and End dates. | |
396 | // Using helper webtestFillDate function. | |
397 | $this->webtestFillDateTime("start_date", "+1 week"); | |
398 | $this->webtestFillDateTime("end_date", "+1 week 1 day 8 hours "); | |
399 | ||
400 | $this->type("max_participants", "50"); | |
401 | $this->click("is_map"); | |
50d95825 | 402 | $this->clickLink("_qf_EventInfo_upload-bottom"); |
6a488035 TO |
403 | } |
404 | ||
4cbe18b8 EM |
405 | /** |
406 | * @param $streetAddress | |
407 | */ | |
00be9182 | 408 | public function _testAddLocation($streetAddress) { |
6a488035 | 409 | // Wait for Location tab form to load |
50d95825 | 410 | $this->waitForAjaxContent(); |
6a488035 TO |
411 | $this->waitForElementPresent("_qf_Location_upload-bottom"); |
412 | ||
413 | // Fill in address fields | |
414 | $streetAddress = "100 Main Street"; | |
415 | $this->type("address_1_street_address", $streetAddress); | |
416 | $this->type("address_1_city", "San Francisco"); | |
417 | $this->type("address_1_postal_code", "94117"); | |
86797006 | 418 | $this->select('address_1_country_id', 'UNITED STATES'); |
6a488035 TO |
419 | $this->select("address_1_state_province_id", "value=1004"); |
420 | $this->type("email_1_email", "info@civicrm.org"); | |
421 | ||
422 | $this->click("_qf_Location_upload-bottom"); | |
423 | ||
424 | // Wait for "saved" status msg | |
02e08b2e | 425 | $this->waitForText('crm-notification-container', "'Event Location' information has been saved."); |
6a488035 TO |
426 | } |
427 | ||
4cbe18b8 EM |
428 | /** |
429 | * @param bool $discount | |
430 | * @param bool $priceSet | |
431 | * @param string $processorName | |
432 | * @param bool $double | |
433 | * @param bool $payLater | |
434 | * | |
435 | * @return array | |
436 | */ | |
00be9182 | 437 | public function _testAddFees($discount = FALSE, $priceSet = FALSE, $processorName = "PP Pro", $double = FALSE, $payLater = FALSE) { |
6a488035 TO |
438 | $discount1 = "Early-bird" . substr(sha1(rand()), 0, 7); |
439 | $discount2 = ""; | |
440 | // Go to Fees tab | |
441 | $this->click("link=Fees"); | |
442 | $this->waitForElementPresent("_qf_Fee_upload-bottom"); | |
443 | $this->click("CIVICRM_QFID_1_is_monetary"); | |
0dce9149 PJ |
444 | |
445 | if ($payLater) { | |
02e08b2e | 446 | $this->click('is_pay_later'); |
8ca3d31e | 447 | $this->fillRichTextField('pay_later_receipt', 'testing later instructions'); |
0dce9149 PJ |
448 | } |
449 | else { | |
450 | $this->uncheck('is_pay_later'); | |
451 | } | |
452 | ||
453 | if ($processorName) { | |
a90dac23 | 454 | $this->select2('payment_processor', $processorName, TRUE); |
0dce9149 | 455 | } |
6a488035 TO |
456 | $this->select("financial_type_id", "value=4"); |
457 | if ($priceSet) { | |
458 | // get one - TBD | |
459 | } | |
460 | else { | |
461 | $this->type("label_1", "Member"); | |
462 | $this->type("value_1", "225.00"); | |
463 | $this->type("label_2", "Non-member"); | |
464 | $this->type("value_2", "300.00"); | |
02e08b2e | 465 | $this->click("CIVICRM_QFID_1_6"); |
6a488035 TO |
466 | } |
467 | ||
468 | if ($discount) { | |
469 | // enter early bird discount fees | |
470 | $this->click("is_discount"); | |
471 | $this->waitForElementPresent("discount_name_1"); | |
472 | $this->type("discount_name_1", $discount1); | |
473 | $this->webtestFillDate("discount_start_date_1", "-3 week"); | |
474 | $this->webtestFillDate("discount_end_date_1", "-2 week"); | |
76e86fd8 CW |
475 | $this->clickLink("_qf_Fee_submit", "discounted_value_1_1"); |
476 | ||
6712d671 | 477 | $this->type("discounted_value_1_1", "225.00"); |
478 | $this->type("discounted_value_2_1", "300.00"); | |
6a488035 TO |
479 | |
480 | if ($double) { | |
481 | $discount2 = "Early-bird" . substr(sha1(rand()), 0, 7); | |
482 | // enter early bird discount fees | |
483 | $this->click("link=another discount set"); | |
484 | $this->waitForElementPresent("discount_name_2"); | |
485 | $this->type("discount_name_2", $discount2); | |
486 | $this->webtestFillDate("discount_start_date_2", "-1 week"); | |
487 | $this->webtestFillDate("discount_end_date_2", "+1 week"); | |
225a8648 | 488 | $this->clickLink("_qf_Fee_submit", "discounted_value_2_1"); |
6712d671 | 489 | $this->type("discounted_value_1_2", "225.00"); |
490 | $this->type("discounted_value_2_2", "300.00"); | |
491 | } | |
6a488035 TO |
492 | $this->click("xpath=//fieldset[@id='discount']/fieldset/table/tbody/tr[2]/td[3]/input"); |
493 | } | |
494 | $this->click("_qf_Fee_upload-bottom"); | |
76e86fd8 | 495 | |
6a488035 | 496 | // Wait for "saved" status msg |
02e08b2e | 497 | $this->waitForText('crm-notification-container', "'Fees' information has been saved"); |
6a488035 TO |
498 | return array($discount1, $discount2); |
499 | } | |
500 | ||
4cbe18b8 EM |
501 | /** |
502 | * @param $registerIntro | |
503 | * @param bool $multipleRegistrations | |
504 | */ | |
bc6ec2cd | 505 | public function _testAddOnlineRegistration($registerIntro, $multipleRegistrations = FALSE, $allowSelfService = FALSE) { |
6a488035 TO |
506 | // Go to Online Registration tab |
507 | $this->click("link=Online Registration"); | |
508 | $this->waitForElementPresent("_qf_Registration_upload-bottom"); | |
509 | ||
60709d21 JP |
510 | $isChecked = $this->isChecked('is_online_registration'); |
511 | if (!$isChecked) { | |
512 | $this->click("is_online_registration"); | |
513 | } | |
6a488035 TO |
514 | $this->assertChecked("is_online_registration"); |
515 | if ($multipleRegistrations) { | |
60709d21 JP |
516 | $isChecked = $this->isChecked('is_multiple_registrations'); |
517 | if (!$isChecked) { | |
518 | $this->click("is_multiple_registrations"); | |
519 | } | |
6a488035 TO |
520 | $this->assertChecked("is_multiple_registrations"); |
521 | } | |
522 | ||
bc6ec2cd WA |
523 | //enable 'Allow self-service' |
524 | if ($allowSelfService) { | |
525 | $isChecked = $this->isChecked('allow_selfcancelxfer'); | |
526 | if (!$isChecked) { | |
527 | $this->click("allow_selfcancelxfer"); | |
528 | } | |
529 | $this->assertChecked("allow_selfcancelxfer"); | |
530 | } | |
02e08b2e | 531 | $this->fillRichTextField("intro_text", $registerIntro, 'CKEditor', TRUE); |
76e86fd8 | 532 | |
6a488035 TO |
533 | // enable confirmation email |
534 | $this->click("CIVICRM_QFID_1_is_email_confirm"); | |
76e86fd8 CW |
535 | $this->type("confirm_from_name", "Jane Doe"); |
536 | ||
6a488035 TO |
537 | $this->type("confirm_from_email", "jane.doe@example.org"); |
538 | ||
539 | $this->click("_qf_Registration_upload-bottom"); | |
02e08b2e | 540 | $this->waitForText('crm-notification-container', "'Online Registration' information has been saved."); |
6a488035 TO |
541 | } |
542 | ||
4cbe18b8 EM |
543 | /** |
544 | * @param $eventTitle | |
545 | * @param $eventInfoStrings | |
546 | * @param null $eventFees | |
547 | * | |
548 | * @return null | |
549 | */ | |
00be9182 | 550 | public function _testVerifyEventInfo($eventTitle, $eventInfoStrings, $eventFees = NULL) { |
6a488035 TO |
551 | // verify event input on info page |
552 | // start at Manage Events listing | |
071a6d2e | 553 | $this->openCiviPage("event/manage", "reset=1"); |
6a488035 TO |
554 | $this->click("link=$eventTitle"); |
555 | ||
556 | // Look for Register button | |
557 | $this->waitForElementPresent("link=Register Now"); | |
558 | ||
559 | // Check for correct event info strings | |
560 | $this->assertStringsPresent($eventInfoStrings); | |
76e86fd8 | 561 | |
6a488035 TO |
562 | // Optionally verify event fees (especially for discounts) |
563 | if ($eventFees) { | |
76e86fd8 CW |
564 | $this->assertStringsPresent($eventFees); |
565 | ||
6a488035 | 566 | } |
a471a3b6 | 567 | return $this->urlArg('id'); |
6a488035 TO |
568 | } |
569 | ||
4cbe18b8 EM |
570 | /** |
571 | * @param $registerStrings | |
572 | * | |
573 | * @return string | |
574 | */ | |
00be9182 | 575 | public function _testVerifyRegisterPage($registerStrings) { |
6a488035 TO |
576 | // Go to Register page and check for intro text and fee levels |
577 | $this->click("link=Register Now"); | |
578 | $this->waitForElementPresent("_qf_Register_upload-bottom"); | |
579 | $this->assertStringsPresent($registerStrings); | |
580 | return $this->getLocation(); | |
581 | } | |
582 | ||
4cbe18b8 EM |
583 | /** |
584 | * @param $registerUrl | |
585 | * @param int $numberRegistrations | |
586 | * @param bool $anonymous | |
587 | * @param bool $isPayLater | |
588 | * @param array $participantEmailInfo | |
589 | * @param null $paymentProcessor | |
590 | * | |
591 | * @return array | |
592 | */ | |
00be9182 | 593 | public function _testOnlineRegistration($registerUrl, $numberRegistrations = 1, $anonymous = TRUE, $isPayLater = FALSE, $participantEmailInfo = array(), $paymentProcessor = NULL) { |
dc91d100 PJ |
594 | $infoPassed = FALSE; |
595 | if (!empty($participantEmailInfo)) { | |
596 | $infoPassed = TRUE; | |
597 | } | |
6a488035 | 598 | if ($anonymous) { |
42daf119 | 599 | $this->webtestLogout(); |
6a488035 | 600 | } |
4a2859ea | 601 | $primaryParticipantInfo = array(); |
6a488035 | 602 | $this->open($registerUrl); |
dc91d100 PJ |
603 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
604 | ||
57e9cdaf CW |
605 | $this->waitForElementPresent('additional_participants'); |
606 | ||
6a488035 | 607 | $this->select("additional_participants", "value=" . $numberRegistrations); |
dc91d100 | 608 | |
5480e9b2 | 609 | if ($infoPassed) { |
610 | $primaryParticipantInfo['first_name'] = $participantEmailInfo[0]['first_name']; | |
611 | $primaryParticipantInfo['last_name'] = $participantEmailInfo[0]['last_name']; | |
612 | $primaryParticipantInfo['email'] = $participantEmailInfo[0]['email']; | |
613 | } | |
614 | else { | |
615 | $primaryParticipantInfo['first_name'] = "Jane"; | |
616 | $primaryParticipantInfo['last_name'] = "Smith" . substr(sha1(rand()), 0, 7); | |
617 | $primaryParticipantInfo['email'] = "smith" . substr(sha1(rand()), 0, 7) . "@example.org"; | |
618 | } | |
619 | ||
8ca3d31e | 620 | $this->type("first_name", $primaryParticipantInfo['first_name']); |
621 | $this->type("last_name", $primaryParticipantInfo['last_name']); | |
5480e9b2 | 622 | $this->type("email-Primary", $primaryParticipantInfo['email']); |
8ca3d31e | 623 | |
f9057553 | 624 | if (!$isPayLater) { |
dc91d100 | 625 | if ($paymentProcessor) { |
6712d671 | 626 | $paymentProcessorEle = $this->getAttribute("xpath=//form[@id='Register']//label[contains(text(), '{$paymentProcessor}')]/@for"); |
02e08b2e | 627 | $this->click($paymentProcessorEle); |
dc91d100 | 628 | } |
f9057553 PN |
629 | $this->select("credit_card_type", "value=Visa"); |
630 | $this->type("credit_card_number", "4111111111111111"); | |
631 | $this->type("cvv2", "000"); | |
632 | $this->select("credit_card_exp_date[M]", "value=1"); | |
633 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
4a2859ea PJ |
634 | $this->type("billing_first_name", $primaryParticipantInfo['first_name']); |
635 | $this->type("billing_last_name", $primaryParticipantInfo['last_name']); | |
f9057553 PN |
636 | $this->type("billing_street_address-5", "15 Main St."); |
637 | $this->type(" billing_city-5", "San Jose"); | |
638 | $this->select("billing_country_id-5", "value=1228"); | |
639 | $this->select("billing_state_province_id-5", "value=1004"); | |
640 | $this->type("billing_postal_code-5", "94129"); | |
641 | } | |
6a488035 TO |
642 | |
643 | $this->click("_qf_Register_upload-bottom"); | |
644 | ||
645 | if ($numberRegistrations > 1) { | |
646 | for ($i = 1; $i <= $numberRegistrations; $i++) { | |
647 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
648 | // Look for Skip button | |
649 | $this->waitForElementPresent("_qf_Participant_{$i}_next_skip-Array"); | |
8ca3d31e | 650 | |
5480e9b2 | 651 | if ($infoPassed) { |
652 | $this->type("first_name", $participantEmailInfo[$i]['first_name']); | |
653 | $this->type("last_name", $participantEmailInfo[$i]['last_name']); | |
654 | $this->type("email-Primary", $participantEmailInfo[$i]['email']); | |
655 | } | |
656 | else { | |
657 | $this->type("first_name", "Jane Add $i"); | |
658 | $this->type("last_name", "Smith" . substr(sha1(rand()), 0, 7)); | |
659 | $this->type("email-Primary", "smith" . substr(sha1(rand()), 0, 7) . "@example.org"); | |
660 | } | |
8ca3d31e | 661 | |
6a488035 TO |
662 | $this->click("_qf_Participant_{$i}_next"); |
663 | } | |
664 | } | |
665 | ||
666 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
667 | $this->waitForElementPresent("_qf_Confirm_next-bottom"); | |
6712d671 | 668 | $confirmStrings = array("Event Fee(s)"); |
669 | if (!$isPayLater) { | |
670 | $confirmStrings += array("Billing Name and Address", "Credit Card Information"); | |
f9057553 | 671 | } |
6a488035 TO |
672 | $this->assertStringsPresent($confirmStrings); |
673 | $this->click("_qf_Confirm_next-bottom"); | |
674 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
6712d671 | 675 | $thankStrings = array("Thank You for Registering", "Event Total"); |
676 | if (!$isPayLater) { | |
f9057553 PN |
677 | $thankStrings = array("Transaction Date"); |
678 | } | |
679 | else { | |
680 | $thankStrings += array("testing later instructions"); | |
681 | } | |
6a488035 | 682 | $this->assertStringsPresent($thankStrings); |
4a2859ea | 683 | return $primaryParticipantInfo; |
6a488035 TO |
684 | } |
685 | ||
4cbe18b8 EM |
686 | /** |
687 | * @param $eventTitle | |
688 | */ | |
00be9182 | 689 | public function _testAddReminder($eventTitle) { |
6a488035 | 690 | // Go to Schedule Reminders tab |
d2abb0a8 | 691 | $this->click("link=Schedule Reminders"); |
02e08b2e DG |
692 | $this->waitForElementPresent("newScheduleReminder"); |
693 | $this->click("newScheduleReminder"); | |
64b211dd | 694 | $this->waitForElementPresent("_qf_ScheduleReminders_next-bottom"); |
6a488035 TO |
695 | $this->type("title", "Event Reminder for " . $eventTitle); |
696 | $this->select('entity', 'label=Registered'); | |
697 | ||
698 | $this->select('start_action_offset', 'label=1'); | |
699 | $this->select('start_action_condition', 'label=after'); | |
700 | $this->click('is_repeat'); | |
701 | $this->select('repetition_frequency_interval', 'label=2'); | |
702 | $this->select('end_date', 'label=Event End Date'); | |
703 | $this->click('recipient'); | |
704 | $this->select('recipient', 'label=Participant Role'); | |
705 | // $this->select( 'recipient_listing', 'value=1' ); | |
706 | ||
707 | // Fill Subject | |
708 | $subject = 'subject' . substr(sha1(rand()), 0, 4); | |
709 | $this->type('subject', $subject); | |
710 | $this->fillRichTextField("html_message", "This is the test HTML version here!!!", 'CKEditor'); | |
711 | ||
712 | $this->type("text_message", "This is the test text version here!!!"); | |
713 | //click on save | |
64b211dd | 714 | $this->click('_qf_ScheduleReminders_next-bottom'); |
6a488035 TO |
715 | $this->waitForElementPresent("link=Add Reminder"); |
716 | ||
64b211dd | 717 | $this->waitForElementPresent("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td[7]/span/a[1]"); |
6a488035 TO |
718 | |
719 | $verifyText = array( | |
720 | 1 => 'Event Reminder for ' . $eventTitle, | |
721 | 3 => '1 hour after Event Start Date', | |
722 | 4 => 'Registered', | |
723 | 5 => 'Yes', | |
60709d21 | 724 | 6 => 'Yes', |
6a488035 TO |
725 | ); |
726 | ||
60709d21 | 727 | $this->waitForElementPresent("xpath=//form[@id='ScheduleReminders']//div[@id='option11_wrapper']"); |
6a488035 TO |
728 | //verify the fields for Event Reminder selector |
729 | foreach ($verifyText as $key => $value) { | |
d2abb0a8 | 730 | $this->verifyText("xpath=//div[@class='dataTables_wrapper no-footer']/table/tbody//tr/td[$key]", $value); |
6a488035 TO |
731 | } |
732 | } | |
733 | ||
00be9182 | 734 | public function testEventAddMultipleParticipant() { |
a49e5dea | 735 | $this->markTestSkipped('Skipping for now as it works fine locally.'); |
f9057553 | 736 | // Log in using webtestLogin() method |
4a2859ea | 737 | $this->webtestLogin(); |
f9057553 PN |
738 | $this->openCiviPage("event/add", "reset=1&action=add"); |
739 | ||
740 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
741 | $eventDescription = "Here is a description for this conference."; | |
742 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
743 | $streetAddress = "100 Main Street"; | |
744 | $this->_testAddLocation($streetAddress); | |
745 | ||
dc91d100 | 746 | $this->_testAddFees(FALSE, FALSE, "Test Processor", FALSE, TRUE); |
f9057553 PN |
747 | $registerIntro = "Fill in all the fields below and click Continue."; |
748 | $multipleRegistrations = TRUE; | |
749 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
750 | $eventInfoStrings = array($eventTitle, $eventDescription, $streetAddress); | |
dc91d100 | 751 | $eventId = $this->_testVerifyEventInfo($eventTitle, $eventInfoStrings); |
f9057553 PN |
752 | |
753 | $registerStrings = array("225.00", "Member", "300.00", "Non-member", $registerIntro); | |
754 | $registerUrl = $this->_testVerifyRegisterPage($registerStrings); | |
f9057553 PN |
755 | $numberRegistrations = 3; |
756 | $anonymous = TRUE; | |
dc91d100 PJ |
757 | |
758 | // CRM-12615 add additional participants and check email, amount | |
5480e9b2 | 759 | $primaryParticipant = array( |
760 | 'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org", | |
761 | 'first_name' => "Kate", | |
762 | 'last_name' => "Simth" . substr(sha1(rand()), 0, 7), | |
763 | ); | |
764 | $secParticipant = array( | |
765 | 'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org", | |
766 | 'first_name' => "Kate Add 1", | |
767 | 'last_name' => "Simth" . substr(sha1(rand()), 0, 7), | |
768 | ); | |
769 | $thirdParticipant = array( | |
770 | 'email' => "smith" . substr(sha1(rand()), 0, 7) . "@example.org", | |
771 | 'first_name' => "Kate Add 2", | |
772 | 'last_name' => "Simth" . substr(sha1(rand()), 0, 7), | |
773 | ); | |
774 | ||
dc91d100 | 775 | $participantEmails = array($primaryParticipant, $secParticipant, $thirdParticipant); |
4a2859ea | 776 | $addtlPart = array($secParticipant, $thirdParticipant); |
28a04ea9 | 777 | $primaryParticipantInfo = $this->_testOnlineRegistration($registerUrl, 2, $anonymous, FALSE, $participantEmails, "Test Processor"); |
4a2859ea | 778 | $primaryDisplayName = "{$primaryParticipantInfo['first_name']} {$primaryParticipantInfo['last_name']}"; |
dc91d100 | 779 | $this->webtestLogin(); |
50d95825 | 780 | $this->openCiviPage("event/search", "reset=1"); |
60709d21 | 781 | $this->select2("event_id", $eventTitle, FALSE); |
dc91d100 | 782 | $this->clickLink('_qf_Search_refresh'); |
87a7b760 | 783 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a"); |
a488ca1a | 784 | $this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[@class='crm-participant-sort_name']/a[contains(text(), |
5480e9b2 | 785 | '{$secParticipant['last_name']}, {$secParticipant['first_name']}')]/../../td[6]", preg_quote('225.00')); |
a488ca1a | 786 | $this->verifyText("xpath=//div[@id='participantSearch']/table/tbody//tr/td[@class='crm-participant-sort_name']/a[contains(text(), |
5480e9b2 | 787 | '{$thirdParticipant['last_name']}, {$thirdParticipant['first_name']}')]/../../td[6]", preg_quote('225.00')); |
4a2859ea PJ |
788 | |
789 | //CRM-12618 check edit screen of additional participant and ensuring record_contribution not present | |
790 | foreach ($addtlPart as $value) { | |
57d32317 | 791 | $this->clickAjaxLink("xpath=//div[@id='participantSearch']/table/tbody//tr/td[3]/a[contains(text(), |
5480e9b2 | 792 | '{$value['last_name']}, {$value['first_name']}')]/../../td[11]/span/a[2][contains(text(), 'Edit')]", |
50d95825 | 793 | '_qf_Participant_upload-bottom'); |
5480e9b2 | 794 | $this->assertTrue( |
795 | $this->isElementPresent("xpath=//tr[@class='crm-participant-form-block-registered-by']/td[2]/a[contains(text(), | |
796 | '$primaryDisplayName')]"), 'Registered By info is wrong on additional participant edit form'); | |
5480e9b2 | 797 | $this->assertTrue( |
798 | $this->isElementPresent( | |
799 | "xpath=//table/tbody/tr[@class='crm-participant-form-block-displayName']/td[2][contains(text(), | |
800 | '{$value['first_name']} {$value['last_name']}')]"), | |
4a2859ea PJ |
801 | 'Wrong Participant edit form' |
802 | ); | |
5480e9b2 | 803 | $this->assertFalse($this->isElementPresent('record_contribution'), |
804 | 'Record Payment checkbox showed up wrongly for additional participant edit screen'); | |
57e9cdaf | 805 | $this->click("_qf_Participant_cancel-top"); |
4a2859ea PJ |
806 | } |
807 | ||
dc91d100 PJ |
808 | //unselect the payment processor configured |
809 | $this->openCiviPage("event/manage/fee", "reset=1&action=update&id={$eventId}", '_qf_Fee_upload-bottom'); | |
60709d21 JP |
810 | $this->click("_qf_Fee_upload-bottom"); |
811 | $this->waitForText('crm-notification-container', "'Fees' information has been saved."); | |
dc91d100 | 812 | |
f9057553 PN |
813 | // add participant and 3 additional participant and change status of participant from edit participant |
814 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous, TRUE); | |
dc91d100 | 815 | $this->webtestLogin(); |
f9057553 PN |
816 | |
817 | $this->openCiviPage("event/search?reset=1", "reset=1"); | |
60709d21 | 818 | $this->select2("event_id", $eventTitle, FALSE); |
99f1ef7e | 819 | $this->multiselect2('participant_status_id', array('Pending (pay later)')); |
57e9cdaf | 820 | $this->clickLink('_qf_Search_refresh'); |
63d14d48 | 821 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[2][text()='Edit']"); |
57e9cdaf | 822 | |
63d14d48 RK |
823 | $uRL = $this->getAttribute("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[2][text()='Edit']@href"); |
824 | $this->click("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[2][text()='Edit']"); | |
60709d21 | 825 | $this->waitForElementPresent("status_id"); |
f9057553 | 826 | $this->select('status_id', 'label=Registered'); |
60709d21 | 827 | $this->waitForElementPresent("record_contribution"); |
f9057553 | 828 | $this->click('record_contribution'); |
60709d21 | 829 | $this->waitForElementPresent("contribution_status_id"); |
f9057553 | 830 | $this->select('contribution_status_id', 'label=Completed'); |
60709d21 | 831 | $pID = $this->urlArg('id', $uRL); |
f9057553 PN |
832 | $contributionID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $pID, 'contribution_id', 'participant_id'); |
833 | $this->click('_qf_Participant_upload-top'); | |
60709d21 | 834 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='Edit']"); |
4e38284c | 835 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='View']"); |
60709d21 | 836 | $this->click("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='View']"); |
57e9cdaf | 837 | $this->waitForElementPresent("css=.ui-dialog"); |
4e38284c | 838 | $this->waitForAjaxContent(); |
f9057553 | 839 | $this->verifyFinancialRecords($contributionID); |
6712d671 | 840 | |
f9057553 PN |
841 | // add participant and 3 additional participant and change status of participant from edit contribution |
842 | $this->_testOnlineRegistration($registerUrl, $numberRegistrations, $anonymous, TRUE); | |
6712d671 | 843 | $this->webtestLogin(); |
f9057553 | 844 | |
6712d671 | 845 | $this->openCiviPage("event/search?reset=1", "reset=1"); |
60709d21 | 846 | $this->select2("event_id", $eventTitle, FALSE); |
99f1ef7e | 847 | $this->multiselect2('participant_status_id', array('Pending (pay later)')); |
4e38284c | 848 | $this->clickLink('_qf_Search_refresh'); |
849 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='View']"); | |
60709d21 | 850 | $uRL = $this->getAttribute("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='View']@href"); |
f9057553 | 851 | $this->click("xpath=//div[@id='participantSearch']/table/tbody//tr/td[11]/span/a[text()='View']"); |
60709d21 | 852 | $pID = $this->urlArg('id', $uRL); |
f9057553 | 853 | $contributionID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $pID, 'contribution_id', 'participant_id'); |
60709d21 | 854 | $this->waitForElementPresent("xpath=//tr[@id='rowid$contributionID']/td[8]/span//a[text()='Edit']"); |
f9057553 | 855 | $this->click("xpath=//tr[@id='rowid$contributionID']/td[8]/span//a[text()='Edit']"); |
60709d21 | 856 | $this->waitForElementPresent("_qf_Contribution_upload-bottom"); |
f9057553 | 857 | $this->select('contribution_status_id', 'label=Completed'); |
60709d21 | 858 | $this->clickLink('_qf_Contribution_upload-bottom', '_qf_ParticipantView_cancel-bottom', FALSE); |
4e38284c | 859 | $this->waitForAjaxContent(); |
f9057553 PN |
860 | $this->verifyFinancialRecords($contributionID); |
861 | } | |
862 | ||
4cbe18b8 | 863 | /** |
100fef9d | 864 | * @param int $contributionID |
4cbe18b8 | 865 | */ |
00be9182 | 866 | public function verifyFinancialRecords($contributionID) { |
f9057553 PN |
867 | // check count for civicrm_contribution and civicrm_financial_item in civicrm_entity_financial_trxn |
868 | $query = "SELECT COUNT(DISTINCT(c1.id)) civicrm_contribution, COUNT(c2.id) civicrm_financial_item FROM civicrm_entity_financial_trxn c1 | |
869 | LEFT JOIN civicrm_entity_financial_trxn c2 ON c1.financial_trxn_id = c2.financial_trxn_id AND c2.entity_table ='civicrm_financial_item' | |
870 | LEFT JOIN civicrm_financial_item cfi ON cfi.id = c2.entity_id | |
871 | WHERE c1.entity_table = 'civicrm_contribution' AND c1.entity_id = %1 AND cfi.status_id = 1"; | |
872 | $params = array(1 => array($contributionID, 'Integer')); | |
873 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
874 | $dao->fetch(); | |
875 | $this->assertEquals('2', $dao->civicrm_contribution, 'civicrm_financial_trxn count does not match'); | |
6712d671 | 876 | $this->assertEquals('8', $dao->civicrm_financial_item, 'civicrm_financial_item count does not match'); |
36b1f0cc | 877 | $query = "SELECT COUNT(cft.id) civicrm_financial_trxn FROM civicrm_entity_financial_trxn ceft |
878 | INNER JOIN civicrm_financial_trxn cft ON ceft.financial_trxn_id = cft.id | |
f9057553 PN |
879 | WHERE ceft.entity_id = %1 AND ceft.entity_table = 'civicrm_contribution'"; |
880 | $dao = CRM_Core_DAO::executeQuery($query, $params); | |
881 | $dao->fetch(); | |
882 | $this->assertEquals('2', $dao->civicrm_financial_trxn, 'civicrm_financial_trxn count does not match'); | |
883 | } | |
36b1f0cc | 884 | |
00be9182 | 885 | public function testEventApprovalRegistration() { |
36b1f0cc | 886 | $this->webtestLogin(); |
887 | ||
888 | //Participant Status | |
889 | $this->openCiviPage("admin/participant_status", "reset=1&action=browse"); | |
3e5213ad | 890 | foreach (array('Awaiting approval', 'Pending from approval', 'Rejected') as $label) { |
891 | $status = $this->webtest_civicrm_api("ParticipantStatusType", "getsingle", array('label' => $label)); | |
892 | $this->_testEnableParticipantStatuses($status['id']); | |
893 | $this->isElementPresent("xpath=//tr[@id='participant_status_type-{$status['id']}']/td[9]/span/a[2][text()='Disable']"); | |
894 | } | |
36b1f0cc | 895 | |
896 | //Create New Event | |
897 | ||
898 | $this->openCiviPage('event/add', 'reset=1&action=add', '_qf_EventInfo_upload-bottom'); | |
899 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
900 | $email = 'Smith' . substr(sha1(rand()), 0, 7) . '@example.com'; | |
901 | $eventDescription = 'Here is a description for this conference.'; | |
902 | $this->select('event_type_id', 'value=1'); | |
903 | ||
904 | // Attendee role s/b selected now. | |
905 | $this->select('default_role_id', 'value=1'); | |
906 | // Enter Event Title, Summary and Description | |
907 | $this->type('title', $eventTitle); | |
908 | $this->type('summary', 'This is a great conference. Sign up now!'); | |
909 | ||
910 | // Type description in ckEditor (fieldname, text to type, editor) | |
481a74f4 | 911 | $this->fillRichTextField('description', $eventDescription); |
36b1f0cc | 912 | $this->type('max_participants', '50'); |
913 | $this->click('is_map'); | |
914 | $this->click('_qf_EventInfo_upload-bottom'); | |
915 | ||
916 | // Wait for Location tab form to load | |
917 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
918 | ||
919 | // Go to Fees tab | |
920 | $this->click('link=Fees'); | |
921 | $id = $this->urlArg('id'); | |
922 | $this->waitForElementPresent('_qf_Fee_upload-bottom'); | |
923 | $this->click('CIVICRM_QFID_1_is_monetary'); | |
924 | $processorName = 'Test Processor'; | |
6e677443 | 925 | $this->select2('payment_processor', $processorName, TRUE); |
926 | ||
6c6e6187 TO |
927 | $this->select('financial_type_id', 'label=Event Fee'); |
928 | $this->type("label[1]", 'Junior Stars'); | |
929 | $this->type("value[1]", '500.00'); | |
930 | $this->type("label[2]", 'Super Stars'); | |
931 | $this->type("value[2]", '1000.00'); | |
36b1f0cc | 932 | $this->check('default'); |
933 | $this->click('_qf_Fee_upload-bottom'); | |
60709d21 | 934 | $this->waitForText('crm-notification-container', "'Fees' information has been saved."); |
36b1f0cc | 935 | |
936 | // intro text for registration page | |
937 | $registerIntro = 'Fill in all the fields below and click Continue.'; | |
938 | ||
6c6e6187 TO |
939 | // Go to Online Registration tab |
940 | $this->click('link=Online Registration'); | |
941 | $this->waitForElementPresent('_qf_Registration_upload-bottom'); | |
942 | $this->click('is_online_registration'); | |
943 | $this->assertChecked('is_online_registration'); | |
944 | ||
945 | //Requires Approvel | |
946 | $this->click('requires_approval'); | |
947 | $this->assertChecked('requires_approval'); | |
948 | $this->click('_qf_Registration_upload-bottom'); | |
949 | $this->waitForText('crm-notification-container', "'Online Registration' information has been saved."); | |
950 | ||
951 | // verify event input on info page | |
952 | // start at Manage Events listing | |
953 | $this->openCiviPage('event/manage', 'reset=1'); | |
954 | $this->click("link=$eventTitle"); | |
955 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
956 | $firstName = substr(sha1(rand()), 0, 7); | |
957 | $this->webtestAddContact($firstName, 'Anderson', TRUE); | |
958 | $contactName = "Anderson, $firstName"; | |
959 | $displayName = "$firstName Anderson"; | |
f1224701 | 960 | $this->openCiviPage("event/register", "reset=1&id=$id&action=preview", '_qf_Register_upload-bottom'); |
6c6e6187 TO |
961 | $this->type('first_name', $firstName); |
962 | ||
963 | //fill in last name | |
92fcb95f | 964 | $lastName = 'Recuron' . substr(sha1(rand()), 0, 7); |
6c6e6187 TO |
965 | $this->type('last_name', $contactName); |
966 | $email = $firstName . '@example.com'; | |
967 | $this->type('email-Primary', $email); | |
968 | $this->click('_qf_Register_upload'); | |
969 | $this->waitForElementPresent("_qf_Confirm_next"); | |
970 | $this->click('_qf_Confirm_next'); | |
36b1f0cc | 971 | $this->waitForPageToLoad($this->getTimeoutMsec()); |
eb99a32a | 972 | $this->waitForElementPresent("xpath=//div[@class='crm-group participant_info-group']"); |
6c6e6187 | 973 | $this->assertTextPresent("Thank You for Registering"); |
36b1f0cc | 974 | |
975 | } | |
976 | ||
4cbe18b8 | 977 | /** |
ea3ddccf | 978 | * Test enabling participant statuses. |
979 | * | |
980 | * @param int $statusId | |
4cbe18b8 | 981 | */ |
3e5213ad | 982 | public function _testEnableParticipantStatuses($statusId) { |
6c6e6187 | 983 | // enable participant status |
3e5213ad | 984 | if ($this->isElementPresent("xpath=//tr[@id='participant_status_type-{$statusId}']/td[9]/span/a[2][text()='Enable']")) { |
985 | $this->click("xpath=//tr[@id='participant_status_type-{$statusId}']/td[9]/span/a[2][text()='Enable']"); | |
986 | $this->waitForElementPresent("xpath=//tr[@id='participant_status_type-{$statusId}']/td[9]/span/a[2][text()='Disable']"); | |
6c6e6187 TO |
987 | } |
988 | } | |
96025800 | 989 | |
d2abb0a8 WA |
990 | /** |
991 | * CRM-16777: Allow to add schedule reminder for event with 'edit all event' permission | |
992 | */ | |
993 | public function testConfigureScheduleReminder() { | |
994 | // Log in using webtestLogin() method | |
995 | $this->webtestLogin('admin'); | |
996 | ||
997 | //Details for TestUser1 | |
998 | $role1 = 'role1' . substr(sha1(rand()), 0, 7); | |
999 | $TestUser1 = "TestUser1" . substr(sha1(rand()), 0, 4); | |
1000 | $emailId1 = substr(sha1(rand()), 0, 7) . '@web.com'; | |
1001 | ||
1002 | //create Role1 with permission 'Access CiviCRM', 'edit all events' and 'Access CiviEvent' permissions. | |
1003 | $this->open($this->sboxPath . "admin/people/permissions/roles"); | |
1004 | $this->type("edit-name", $role1); | |
1005 | $this->waitForElementPresent("edit-add"); | |
1006 | $this->click("edit-add"); | |
1007 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
1008 | $this->open($this->sboxPath . "admin/people/permissions/roles"); | |
1009 | $this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role1}']"); | |
1010 | $roleId = explode('/', $this->getAttribute("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role1}']/../td[4]/a[text()='edit permissions']/@href")); | |
1011 | $permissions = array( | |
1012 | "edit-{$roleId[5]}-access-civicrm", | |
1013 | "edit-{$roleId[5]}-edit-all-events", | |
1014 | "edit-{$roleId[5]}-access-civievent", | |
1015 | ); | |
1016 | $this->changePermissions($permissions); | |
1017 | ||
1018 | //Create TestUser1 | |
1019 | $this->open($this->sboxPath . "admin/people/create"); | |
1020 | $this->waitForElementPresent("edit-submit"); | |
1021 | $this->type("edit-name", $TestUser1); | |
1022 | $this->type("edit-mail", $emailId1); | |
1023 | $this->type("edit-pass-pass1", "Test12345"); | |
1024 | $this->type("edit-pass-pass2", "Test12345"); | |
1025 | $this->click("xpath=//div[@class='form-item form-type-checkboxes form-item-roles']/div//div/label[contains(text(), '{$role1}')]"); | |
1026 | $firstName = 'Ma' . substr(sha1(rand()), 0, 4); | |
1027 | $lastName = 'An' . substr(sha1(rand()), 0, 7); | |
1028 | $this->type("first_name", $firstName); | |
1029 | $this->type("last_name", $lastName); | |
1030 | $this->type("street_address-1", "902C El Camino Way SW"); | |
1031 | $this->type("city-1", "Dumfries"); | |
1032 | $this->type("postal_code-1", "1234"); | |
1033 | $this->select("state_province-1", "value=1019"); | |
1034 | $this->click("edit-submit"); | |
1035 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
1036 | ||
1037 | //Add event | |
1038 | $this->openCiviPage("event/add", "reset=1&action=add"); | |
f852aaf4 | 1039 | $this->waitForElementPresent("_qf_EventInfo_cancel-bottom"); |
d2abb0a8 WA |
1040 | $eventName = 'My Event - ' . substr(sha1(rand()), 0, 7); |
1041 | $eventDescription = "Here is a description for this conference."; | |
1042 | $this->_testAddEventInfo($eventName, $eventDescription); | |
1043 | ||
1044 | //Logging out | |
1045 | $this->webtestLogout(); | |
1046 | ||
1047 | //Login with TestUser1 | |
1048 | $this->webtestLogin($TestUser1, 'Test12345'); | |
1049 | $this->openCiviPage("event/manage", "reset=1"); | |
4990eea1 SB |
1050 | $this->type("title", $eventName); |
1051 | $this->click("_qf_SearchEvent_refresh"); | |
d0840350 | 1052 | $this->waitForAjaxContent(); |
d2abb0a8 WA |
1053 | $this->_testAddReminder($eventName); |
1054 | $this->webtestLogout(); | |
1055 | ||
1056 | //Details for TestUser2 | |
1057 | $role2 = 'role2' . substr(sha1(rand()), 0, 5); | |
1058 | $TestUser2 = "TestUser2" . substr(sha1(rand()), 0, 5); | |
1059 | $emailId2 = substr(sha1(rand()), 0, 7) . '@web.com'; | |
1060 | ||
1061 | //create Role2 with only 'Access CiviCRM' and 'Access CiviEvent' permissions | |
1062 | $this->webtestLogin('admin'); | |
1063 | $this->open($this->sboxPath . "admin/people/permissions/roles"); | |
1064 | $this->type("edit-name", $role2); | |
1065 | $this->waitForElementPresent("edit-add"); | |
1066 | $this->click("edit-add"); | |
1067 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
1068 | $this->open($this->sboxPath . "admin/people/permissions/roles"); | |
1069 | $this->waitForElementPresent("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role2}']"); | |
1070 | $roleId = explode('/', $this->getAttribute("xpath=//table[@id='user-roles']/tbody//tr/td[1][text()='{$role2}']/../td[4]/a[text()='edit permissions']/@href")); | |
1071 | $permissions = array( | |
1072 | "edit-{$roleId[5]}-access-civicrm", | |
1073 | "edit-{$roleId[5]}-access-civievent", | |
1074 | ); | |
1075 | $this->changePermissions($permissions); | |
1076 | ||
1077 | //Create TestUser2 | |
1078 | $this->open($this->sboxPath . "admin/people/create"); | |
1079 | $this->waitForElementPresent("edit-submit"); | |
1080 | $this->type("edit-name", $TestUser2); | |
1081 | $this->type("edit-mail", $emailId2); | |
1082 | $this->type("edit-pass-pass1", "Test123"); | |
1083 | $this->type("edit-pass-pass2", "Test123"); | |
1084 | $this->click("xpath=//div[@class='form-item form-type-checkboxes form-item-roles']/div//div/label[contains(text(), '{$role2}')]"); | |
1085 | $firstName = 'Smith' . substr(sha1(rand()), 0, 4); | |
1086 | $lastName = 'John' . substr(sha1(rand()), 0, 5); | |
1087 | $this->type("first_name", $firstName); | |
1088 | $this->type("last_name", $lastName); | |
1089 | $this->type("street_address-1", "902C El Camino Way SW"); | |
1090 | $this->type("city-1", "Dumfries"); | |
1091 | $this->type("postal_code-1", "1234"); | |
1092 | $this->select("state_province-1", "value=1019"); | |
1093 | $this->click("edit-submit"); | |
1094 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
1095 | ||
1096 | //Logout | |
1097 | $this->webtestLogout(); | |
1098 | ||
1099 | //Login with TestUser2 | |
1100 | $this->webtestLogin($TestUser2, 'Test123'); | |
1101 | $this->openCiviPage("event/manage", "reset=1"); | |
1102 | $this->waitForElementPresent("xpath=//div[@id='event_status_id']/div[@class='dataTables_wrapper no-footer']"); | |
1103 | $this->verifyText("xpath=//div[@id='event_status_id']/div[@class='dataTables_wrapper no-footer']/table/tbody/tr/td", "None found."); | |
1104 | $this->webtestLogout(); | |
1105 | } | |
1106 | ||
bc6ec2cd WA |
1107 | /** |
1108 | * CRM-16761: Self service view, update and cancel for CiviEvent | |
1109 | */ | |
1110 | public function testAllowSelfService() { | |
1111 | $this->webtestLogin('admin'); | |
1112 | ||
1113 | // Create Individual | |
1114 | $contact1 = substr(sha1(rand()), 0, 7); | |
1115 | $this->webtestAddContact($contact1, "Anderson", "{$contact1}@example.com"); | |
1116 | ||
1117 | // Add event | |
1118 | $this->openCiviPage("event/add", "reset=1&action=add"); | |
1119 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
1120 | $eventDescription = "Here is a description for this conference."; | |
1121 | $registerIntro = "Fill in all the fields below and click Continue."; | |
1122 | $multipleRegistrations = TRUE; | |
1123 | $allowSelfService = TRUE; | |
1124 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
1125 | $streetAddress = "100 Main Street"; | |
1126 | $this->_testAddLocation($streetAddress); | |
1127 | $this->_testAddFees(FALSE, FALSE, "Test Processor", FALSE, TRUE); | |
6f006c26 | 1128 | $this->_testAddOnlineRegistration($registerIntro, FALSE, $allowSelfService); |
bc6ec2cd WA |
1129 | |
1130 | // Register participant | |
1131 | $id = $this->urlArg('id'); | |
1132 | $this->openCiviPage("event/register", "reset=1&id=$id&action=preview", '_qf_Register_upload-bottom'); | |
6f006c26 WA |
1133 | $this->waitForElementPresent("xpath=//div[@id='crm-event-register-different']/a"); |
1134 | $this->click("xpath=//div[@id='crm-event-register-different']/a"); | |
1135 | $this->waitForAjaxcontent(); | |
1136 | $this->select2("select_contact_id", "$contact1"); | |
bc6ec2cd | 1137 | |
9693f731 | 1138 | // Fill card details |
bc6ec2cd WA |
1139 | $this->select("credit_card_type", "value=Visa"); |
1140 | $this->type("credit_card_number", "4111111111111111"); | |
1141 | $this->type("cvv2", "000"); | |
1142 | $this->select("credit_card_exp_date[M]", "value=1"); | |
1143 | $this->select("credit_card_exp_date[Y]", "value=2020"); | |
9693f731 WA |
1144 | |
1145 | // Add billing Address | |
1146 | $this->webtestAddBillingDetails($contact1, NULL, 'Anderson'); | |
bc6ec2cd WA |
1147 | $this->click("_qf_Register_upload-bottom"); |
1148 | $this->waitForPageToLoad($this->getTimeoutMsec()); | |
1149 | $this->waitForElementPresent("_qf_Confirm_next-top"); | |
1150 | $this->click("_qf_Confirm_next-top"); | |
1151 | ||
1152 | // Find Participant. | |
1153 | $this->openCiviPage("event/search", "reset=1"); | |
1154 | $this->waitForElementPresent("_qf_Search_refresh"); | |
1155 | $this->type('sort_name', "Anderson, $contact1"); | |
bc6ec2cd WA |
1156 | $this->click("_qf_Search_refresh"); |
1157 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']"); | |
1158 | ||
1159 | // Get the id of primary participant | |
1160 | $primaryParticipantId = $this->urlArg('id', $this->getAttribute("xpath=//div[@id='participantSearch']/table/tbody/tr/td[3]/a[text()='Anderson, $contact1']/../../td[11]/span/a[1][text()='View']@href")); | |
6f006c26 WA |
1161 | |
1162 | // Get the contact id of primary participant | |
1163 | $primaryParticipantContactid = $this->urlArg('cid', $this->getAttribute("xpath=//div[@id='participantSearch']/table/tbody/tr/td[3]/a[text()='Anderson, $contact1']/../../td[11]/span/a[1][text()='View']@href")); | |
1164 | ||
1165 | // Generate checksum for primary participant | |
1166 | $checkSum = CRM_Contact_BAO_Contact_Utils::generateChecksum($primaryParticipantContactid); | |
1167 | $this->open($this->sboxPath . "admin/people/permissions/roles"); | |
1168 | $permissions = array( | |
1169 | "edit-1-access-civicrm", | |
1170 | "edit-1-access-civievent", | |
1171 | "edit-1-edit-all-events", | |
1172 | ); | |
bc6ec2cd WA |
1173 | $this->webtestLogout(); |
1174 | ||
6f006c26 WA |
1175 | // Transfer event registration. |
1176 | $this->openCiviPage("event/selfsvcupdate", "reset=1&pid=$primaryParticipantId&cs=$checkSum"); | |
bc6ec2cd WA |
1177 | $this->waitForElementPresent("xpath=//table[@class='crm-selfsvcupdate-form-details']"); |
1178 | $this->verifyText("xpath=//table[@class='crm-selfsvcupdate-form-details']/tbody/tr/td[1]", preg_quote("Anderson, $contact1")); | |
1179 | $this->verifyText("xpath=//table[@class='crm-selfsvcupdate-form-details']/tbody/tr/td[2]", preg_quote("$eventTitle")); | |
1180 | $this->select("action", "value=1"); | |
1181 | $this->click("_qf_SelfSvcUpdate_submit-bottom"); | |
6f006c26 | 1182 | $this->waitForElementPresent("_qf_SelfSvcTransfer_submit-bottom"); |
bc6ec2cd WA |
1183 | $newParticipantFirstName = substr(sha1(rand()), 0, 5); |
1184 | $newParticipantLastName = "Smith"; | |
1185 | $newParticipantEmail = "{$newParticipantFirstName}@example.com"; | |
1186 | $this->type('email', $newParticipantEmail); | |
1187 | $this->type('last_name', $newParticipantLastName); | |
1188 | $this->type('first_name', $newParticipantFirstName); | |
1189 | $this->click("_qf_SelfSvcTransfer_submit-bottom"); | |
1190 | ||
6f006c26 | 1191 | // Cancel event registration. |
bc6ec2cd WA |
1192 | $this->webtestLogin('admin'); |
1193 | $this->openCiviPage("event/search", "reset=1"); | |
1194 | $this->type('sort_name', "Smith, $newParticipantFirstName"); | |
bc6ec2cd WA |
1195 | $this->click("_qf_Search_refresh"); |
1196 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody/tr/td[3]/a[text()='Smith, $newParticipantFirstName']/../../td[11]/span/a[1][text()='View']"); | |
6f006c26 WA |
1197 | |
1198 | // Get the id of new participant | |
bc6ec2cd | 1199 | $newParticipantId = $this->urlArg('id', $this->getAttribute("xpath=//div[@id='participantSearch']/table/tbody/tr/td[3]/a[text()='Smith, $newParticipantFirstName']/../../td[11]/span/a[1][text()='View']@href")); |
6f006c26 WA |
1200 | |
1201 | // Get the contact id of new participant | |
1202 | $newParticipantContactId = $this->urlArg('cid', $this->getAttribute("xpath=//div[@id='participantSearch']/table/tbody/tr/td[3]/a[text()='Smith, $newParticipantFirstName']/../../td[11]/span/a[1][text()='View']@href")); | |
1203 | ||
1204 | // Generate checksum for new participant | |
1205 | $newParticipantcheckSum = CRM_Contact_BAO_Contact_Utils::generateChecksum($newParticipantContactId); | |
bc6ec2cd | 1206 | $this->webtestLogout(); |
6f006c26 | 1207 | $this->openCiviPage("event/selfsvcupdate", "reset=1&pid=$newParticipantId&cs=$newParticipantcheckSum"); |
bc6ec2cd WA |
1208 | $this->verifyText("xpath=//table[@class='crm-selfsvcupdate-form-details']/tbody/tr/td[1]", preg_quote("Smith, $newParticipantFirstName")); |
1209 | $this->verifyText("xpath=//table[@class='crm-selfsvcupdate-form-details']/tbody/tr/td[2]", preg_quote("$eventTitle")); | |
1210 | $this->select("action", "value=2"); | |
1211 | $this->click("_qf_SelfSvcUpdate_submit-bottom"); | |
1212 | ||
1213 | // Check the status of participant | |
1214 | $this->webtestLogin('admin'); | |
1215 | $this->openCiviPage("event/search", "reset=1"); | |
1216 | $this->waitForElementPresent('_qf_Search_refresh'); | |
1217 | $this->select2("event_id", $eventTitle); | |
6f006c26 | 1218 | $this->click("xpath=//div[@id='searchForm']/table/tbody/tr[9]/td[1]/label[text()='No']"); |
bc6ec2cd WA |
1219 | $this->click("_qf_Search_refresh"); |
1220 | $this->waitForElementPresent("xpath=//div[@id='participantSearch']/table/tbody"); | |
6f006c26 WA |
1221 | $this->assertElementContainsText("xpath=//div[@id='participantSearch']/table/tbody/tr[@id='rowid$primaryParticipantId']/td[9]", "Transferred"); |
1222 | $this->assertElementContainsText("xpath=//div[@id='participantSearch']/table/tbody/tr[@id='rowid$newParticipantId']/td[9]", "Cancelled"); | |
bc6ec2cd WA |
1223 | } |
1224 | ||
7f08e6c6 J |
1225 | /** |
1226 | * CRM-17745: Make maximum number of participants configurable | |
1227 | */ | |
1228 | public function testLimitMaximumParticipants() { | |
1229 | $this->webtestLogin('admin'); | |
1230 | ||
1231 | // Add event | |
1232 | $this->openCiviPage("event/add", "reset=1&action=add"); | |
1233 | $eventTitle = 'My Conference - ' . substr(sha1(rand()), 0, 7); | |
1234 | $eventDescription = "Here is a description for this conference."; | |
1235 | $registerIntro = "Fill in all the fields below and click Continue."; | |
1236 | $this->_testAddEventInfo($eventTitle, $eventDescription); | |
1237 | $multipleRegistrations = TRUE; | |
1238 | $this->_testAddOnlineRegistration($registerIntro, $multipleRegistrations); | |
1239 | $id = $this->urlArg('id'); | |
1240 | ||
1241 | // Limit additional participants | |
1242 | $this->openCiviPage("event/manage/registration", "reset=1&action=update&id=$id", '_qf_Registration_upload-bottom'); | |
1243 | $this->select("max_additional_participants", "value=4"); | |
1244 | $this->click("_qf_Registration_upload-bottom"); | |
1245 | $this->waitForText('crm-notification-container', "'Online Registration' information has been saved."); | |
1246 | ||
1247 | // Open registration page and check maximum participants | |
1248 | $this->openCiviPage("event/register", "reset=1&id=$id&action=preview", '_qf_Register_upload-bottom'); | |
1249 | $this->verifyText("xpath=//select[@id='additional_participants']/option[last()]", 5); | |
1250 | } | |
1251 | ||
42daf119 | 1252 | } |