Remove extraneous full stop, line
[civicrm-core.git] / tests / phpunit / CRM / Event / Form / Registration / ConfirmTest.php
CommitLineData
632196ea 1<?php
2
3/**
4 * Test CRM_Event_Form_Registration functions.
5 *
6 * @package CiviCRM
7 * @group headless
8 */
9class CRM_Event_Form_Registration_ConfirmTest extends CiviUnitTestCase {
10
6d2e7dc0 11 use CRMTraits_Profile_ProfileTrait;
12
632196ea 13 public function setUp() {
14 $this->useTransaction(TRUE);
15 parent::setUp();
16 }
17
18 /**
19 * Initial test of submit function.
20 *
21 * @throws \Exception
22 */
23 public function testSubmit() {
24 $event = $this->eventCreate();
e579af79 25 $mut = new CiviMailUtils($this, TRUE);
9099cab3 26 CRM_Event_Form_Registration_Confirm::testSubmit([
632196ea 27 'id' => $event['id'],
28 'contributeMode' => 'direct',
29 'registerByID' => $this->createLoggedInUser(),
9099cab3
CW
30 'params' => [
31 [
632196ea 32 'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
33 'entryURL' => 'http://dmaster.local/civicrm/event/register?reset=1&amp;id=3',
34 'first_name' => 'k',
35 'last_name' => 'p',
36 'email-Primary' => 'demo@example.com',
37 'hidden_processor' => '1',
38 'credit_card_number' => '4111111111111111',
39 'cvv2' => '123',
9099cab3 40 'credit_card_exp_date' => [
632196ea 41 'M' => '1',
42 'Y' => '2019',
9099cab3 43 ],
632196ea 44 'credit_card_type' => 'Visa',
45 'billing_first_name' => 'p',
46 'billing_middle_name' => '',
47 'billing_last_name' => 'p',
48 'billing_street_address-5' => 'p',
49 'billing_city-5' => 'p',
50 'billing_state_province_id-5' => '1061',
51 'billing_postal_code-5' => '7',
52 'billing_country_id-5' => '1228',
53 'scriptFee' => '',
54 'scriptArray' => '',
55 'priceSetId' => '6',
9099cab3 56 'price_7' => [
29541621 57 13 => 1,
9099cab3 58 ],
632196ea 59 'payment_processor_id' => '1',
60 'bypass_payment' => '',
61 'MAX_FILE_SIZE' => '33554432',
62 'is_primary' => 1,
63 'is_pay_later' => 0,
64 'campaign_id' => NULL,
65 'defaultRole' => 1,
66 'participant_role_id' => '1',
67 'currencyID' => 'USD',
68 'amount_level' => '\ 1Tiny-tots (ages 5-8) - 1\ 1',
69 'amount' => '800.00',
70 'tax_amount' => NULL,
71 'year' => '2019',
72 'month' => '1',
73 'ip_address' => '127.0.0.1',
74 'invoiceID' => '57adc34957a29171948e8643ce906332',
75 'button' => '_qf_Register_upload',
76 'billing_state_province-5' => 'AP',
77 'billing_country-5' => 'US',
9099cab3
CW
78 ],
79 ],
80 ]);
e579af79 81 $participant = $this->callAPISuccessGetSingle('Participant', []);
82 $mut->checkMailLog([
83 'Dear Logged In, Thank you for your participation. This letter is a confirmation that your registration has been received and your status has been updated to Registered.',
84 ]);
85 $mut->stop();
86 $mut->clearMessages();
87 $tplVars = CRM_Core_Smarty::singleton()->get_template_vars();
88 $this->assertEquals($participant['id'], $tplVars['participantID']);
89
632196ea 90 }
91
5e40de84 92 /**
93 * Initial test of submit function for paid event.
94 *
3ae1b2f4 95 * @param string $thousandSeparator
96 *
97 * @dataProvider getThousandSeparators
98 *
5e40de84 99 * @throws \Exception
100 */
3ae1b2f4 101 public function testPaidSubmit($thousandSeparator) {
102 $this->setCurrencySeparators($thousandSeparator);
220bfdc3 103 $mut = new CiviMailUtils($this);
5e40de84 104 $paymentProcessorID = $this->processorCreate();
c1797e86 105 /* @var \CRM_Core_Payment_Dummy $processor */
106 $processor = Civi\Payment\System::singleton()->getById($paymentProcessorID);
107 $processor->setDoDirectPaymentResult(['fee_amount' => 1.67]);
9099cab3 108 $params = ['is_monetary' => 1, 'financial_type_id' => 1];
5e40de84 109 $event = $this->eventCreate($params);
110 $individualID = $this->individualCreate();
9099cab3 111 CRM_Event_Form_Registration_Confirm::testSubmit([
5e40de84 112 'id' => $event['id'],
113 'contributeMode' => 'direct',
114 'registerByID' => $individualID,
115 'paymentProcessorObj' => CRM_Financial_BAO_PaymentProcessor::getPayment($paymentProcessorID),
3ae1b2f4 116 'totalAmount' => $this->formatMoneyInput(8000.67),
9099cab3
CW
117 'params' => [
118 [
5e40de84 119 'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
120 'entryURL' => 'http://dmaster.local/civicrm/event/register?reset=1&amp;id=3',
121 'first_name' => 'k',
122 'last_name' => 'p',
123 'email-Primary' => 'demo@example.com',
124 'hidden_processor' => '1',
125 'credit_card_number' => '4111111111111111',
126 'cvv2' => '123',
9099cab3 127 'credit_card_exp_date' => [
5e40de84 128 'M' => '1',
129 'Y' => '2019',
9099cab3 130 ],
5e40de84 131 'credit_card_type' => 'Visa',
132 'billing_first_name' => 'p',
133 'billing_middle_name' => '',
134 'billing_last_name' => 'p',
135 'billing_street_address-5' => 'p',
136 'billing_city-5' => 'p',
137 'billing_state_province_id-5' => '1061',
138 'billing_postal_code-5' => '7',
139 'billing_country_id-5' => '1228',
5e40de84 140 'priceSetId' => '6',
9099cab3 141 'price_7' => [
5e40de84 142 13 => 1,
9099cab3 143 ],
5e40de84 144 'payment_processor_id' => $paymentProcessorID,
145 'bypass_payment' => '',
5e40de84 146 'is_primary' => 1,
147 'is_pay_later' => 0,
148 'campaign_id' => NULL,
149 'defaultRole' => 1,
150 'participant_role_id' => '1',
151 'currencyID' => 'USD',
152 'amount_level' => '\ 1Tiny-tots (ages 5-8) - 1\ 1',
3ae1b2f4 153 'amount' => $this->formatMoneyInput(8000.67),
5e40de84 154 'tax_amount' => NULL,
155 'year' => '2019',
156 'month' => '1',
157 'ip_address' => '127.0.0.1',
158 'invoiceID' => '57adc34957a29171948e8643ce906332',
159 'button' => '_qf_Register_upload',
160 'billing_state_province-5' => 'AP',
161 'billing_country-5' => 'US',
9099cab3
CW
162 ],
163 ],
164 ]);
165 $this->callAPISuccessGetCount('Participant', [], 1);
166 $contribution = $this->callAPISuccessGetSingle('Contribution', []);
3ae1b2f4 167 $this->assertEquals(8000.67, $contribution['total_amount']);
c1797e86 168 $this->assertEquals(1.67, $contribution['fee_amount']);
169 $this->assertEquals(7999, $contribution['net_amount']);
5e40de84 170 $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC');
171 $financialTrxn = $this->callAPISuccessGetSingle(
172 'FinancialTrxn',
9099cab3 173 [
5e40de84 174 'id' => $lastFinancialTrxnId['financialTrxnId'],
9099cab3
CW
175 'return' => ['payment_processor_id', 'card_type_id.label', 'pan_truncation'],
176 ]
5e40de84 177 );
178 $this->assertEquals(CRM_Utils_Array::value('payment_processor_id', $financialTrxn), $paymentProcessorID);
179 $this->assertEquals(CRM_Utils_Array::value('card_type_id.label', $financialTrxn), 'Visa');
180 $this->assertEquals(CRM_Utils_Array::value('pan_truncation', $financialTrxn), 1111);
c1797e86 181
182 // This looks like it's missing an item for the main contribution - but just locking in current behaviour.
183 $financialItems = $this->callAPISuccess('FinancialItem', 'get', [
184 'return' => ['description', 'financial_account_id', 'amount', 'contact_id', 'currency', 'status_id', 'entity_table', 'entity_id'],
185 'sequential' => 1,
186 ])['values'];
187
188 $entityFinancialTrxns = $this->callAPISuccess('EntityFinancialTrxn', 'get', ['sequential' => 1])['values'];
189
190 $this->assertAPIArrayComparison([
191 'entity_table' => 'civicrm_contribution',
192 'entity_id' => $contribution['id'],
193 'financial_trxn_id' => $financialTrxn['id'],
194 'amount' => '8000.67',
195 ], $entityFinancialTrxns[0], ['id']);
196
197 $this->assertAPIArrayComparison([
198 'entity_table' => 'civicrm_contribution',
199 'entity_id' => $contribution['id'],
200 'financial_trxn_id' => $financialTrxn['id'] + 1,
201 'amount' => '1.67',
202 ], $entityFinancialTrxns[1], ['id']);
203
204 $this->assertAPIArrayComparison([
205 'entity_table' => 'civicrm_financial_item',
206 'entity_id' => $financialItems[0]['id'],
207 'financial_trxn_id' => $financialTrxn['id'] + 1,
208 'amount' => '1.67',
209 ], $entityFinancialTrxns[2], ['id', 'entity_id']);
220bfdc3 210 $mut->checkMailLog([
211 'Event Information and Location', 'Registration Confirmation - Annual CiviCRM meet',
212 'This letter is a confirmation that your registration has been received and your status has been updated to <strong> Registered</strong>',
213 ]);
214 $mut->clearMessages();
5e40de84 215 }
216
6704d983
PN
217 /**
218 * Test for Tax amount for multiple participant.
219 *
d7ade6fe 220 * @throws \CRM_Core_Exception
6704d983
PN
221 */
222 public function testTaxMultipleParticipant() {
d7ade6fe 223 $mut = new CiviMailUtils($this);
9099cab3 224 $params = ['is_monetary' => 1, 'financial_type_id' => 1];
6704d983 225 $event = $this->eventCreate($params);
9099cab3 226 CRM_Event_Form_Registration_Confirm::testSubmit([
6704d983
PN
227 'id' => $event['id'],
228 'contributeMode' => 'direct',
229 'registerByID' => $this->createLoggedInUser(),
230 'totalAmount' => 440,
231 'event' => reset($event['values']),
9099cab3
CW
232 'params' => [
233 [
6704d983
PN
234 'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
235 'entryURL' => "http://dmaster.local/civicrm/event/register?reset=1&amp;id={$event['id']}",
236 'first_name' => 'Participant1',
237 'last_name' => 'LastName',
238 'email-Primary' => 'participant1@example.com',
6704d983
PN
239 'additional_participants' => 2,
240 'payment_processor_id' => 0,
241 'bypass_payment' => '',
242 'MAX_FILE_SIZE' => '33554432',
243 'is_primary' => 1,
244 'is_pay_later' => 1,
245 'campaign_id' => NULL,
246 'defaultRole' => 1,
247 'participant_role_id' => '1',
248 'currencyID' => 'USD',
249 'amount_level' => '\ 1Tiny-tots (ages 5-8) - 1\ 1',
250 'amount' => '100.00',
251 'tax_amount' => 10,
252 'ip_address' => '127.0.0.1',
253 'invoiceID' => '57adc34957a29171948e8643ce906332',
254 'trxn_id' => '123456789',
255 'button' => '_qf_Register_upload',
9099cab3
CW
256 ],
257 [
6704d983
PN
258 'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
259 'entryURL' => "http://dmaster.local/civicrm/event/register?reset=1&amp;id={$event['id']}",
260 'first_name' => 'Participant2',
261 'last_name' => 'LastName',
262 'email-Primary' => 'participant2@example.com',
263 'scriptFee' => '',
264 'scriptArray' => '',
265 'campaign_id' => NULL,
266 'is_pay_later' => 1,
267 'participant_role_id' => '1',
268 'currencyID' => 'USD',
269 'amount_level' => '\ 1Tiny-tots (ages 9-18) - 1\ 1',
270 'amount' => '200.00',
271 'tax_amount' => 20,
9099cab3
CW
272 ],
273 [
6704d983
PN
274 'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
275 'entryURL' => "http://dmaster.local/civicrm/event/register?reset=1&amp;id={$event['id']}",
276 'first_name' => 'Participant3',
277 'last_name' => 'LastName',
278 'email-Primary' => 'participant3@example.com',
279 'scriptFee' => '',
280 'scriptArray' => '',
281 'campaign_id' => NULL,
282 'is_pay_later' => 1,
283 'participant_role_id' => '1',
284 'currencyID' => 'USD',
285 'amount_level' => '\ 1Tiny-tots (ages 5-8) - 1\ 1',
286 'amount' => '100.00',
287 'tax_amount' => 10,
9099cab3
CW
288 ],
289 ],
290 ]);
d7ade6fe 291 $participants = $this->callAPISuccess('Participant', 'get', [])['values'];
292 $this->assertCount(3, $participants);
6704d983
PN
293 $contribution = $this->callAPISuccessGetSingle(
294 'Contribution',
9099cab3
CW
295 [
296 'return' => ['tax_amount', 'total_amount'],
297 ]
6704d983
PN
298 );
299 $this->assertEquals($contribution['tax_amount'], 40, 'Invalid Tax amount.');
300 $this->assertEquals($contribution['total_amount'], 440, 'Invalid Tax amount.');
d7ade6fe 301 $mailSent = $mut->getAllMessages();
302 $this->assertCount(3, $mailSent, 'Three mails should have been sent to the 3 participants.');
6704d983
PN
303 }
304
c91b1cc3
E
305 /**
306 * Test online registration for event with no price options selected as per CRM-19964.
307 */
308 public function testOnlineRegNoPrice() {
9099cab3
CW
309 $paymentProcessorID = $this->processorCreate(['is_default' => TRUE, 'user_name' => 'Test', 'is_test' => FALSE]);
310 $paymentProcessorID = $this->processorCreate(['is_default' => TRUE, 'user_name' => 'Test', 'is_test' => TRUE]);
311 $params = [
c91b1cc3
E
312 'start_date' => date('YmdHis', strtotime('+ 1 week')),
313 'end_date' => date('YmdHis', strtotime('+ 1 year')),
314 'registration_start_date' => date('YmdHis', strtotime('- 1 day')),
315 'registration_end_date' => date('YmdHis', strtotime('+ 1 year')),
316 'payment_processor_id' => $paymentProcessorID,
317 'is_monetary' => TRUE,
318 'financial_type_id' => 'Event Fee',
9099cab3 319 ];
c91b1cc3 320 $event = $this->eventCreate($params);
9099cab3 321 $priceFieldOptions = [
c91b1cc3
E
322 'option_label' => 'Price Field',
323 'option_value' => 100,
324 'is_required' => FALSE,
325 'html_type' => 'Text',
9099cab3 326 ];
c91b1cc3
E
327 $this->createPriceSet('event', $event['id'], $priceFieldOptions);
328
329 $priceField = $this->callAPISuccess('PriceField', 'get',
9099cab3 330 [
c91b1cc3 331 'label' => 'Price Field',
9099cab3 332 ]
c91b1cc3
E
333 );
334 // Create online event registration.
9099cab3 335 CRM_Event_Form_Registration_Confirm::testSubmit([
c91b1cc3
E
336 'id' => $event['id'],
337 'contributeMode' => 'direct',
338 'registerByID' => $this->createLoggedInUser(),
9099cab3
CW
339 'params' => [
340 [
c91b1cc3
E
341 'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
342 'entryURL' => "http://dmaster.local/civicrm/event/register?reset=1&amp;id={$event['id']}",
343 'first_name' => 'Bruce',
344 'last_name' => 'Wayne',
345 'email-Primary' => 'bruce@gotham.com',
346 'price_' . $priceField['id'] => '',
347 'priceSetId' => $priceField['values'][$priceField['id']]['price_set_id'],
348 'payment_processor_id' => $paymentProcessorID,
349 'amount' => 0,
350 'bypass_payment' => '',
351 'MAX_FILE_SIZE' => '33554432',
352 'is_primary' => 1,
353 'is_pay_later' => 0,
354 'campaign_id' => NULL,
355 'defaultRole' => 1,
356 'participant_role_id' => '1',
357 'tax_amount' => NULL,
358 'ip_address' => '127.0.0.1',
359 'invoiceID' => '57adc34957a29171948e8643ce906332',
360 'button' => '_qf_Register_upload',
361 'scriptFee' => '',
362 'scriptArray' => '',
9099cab3
CW
363 ],
364 ],
365 ]);
366 $contribution = $this->callAPISuccess('Contribution', 'get', ['invoice_id' => '57adc34957a29171948e8643ce906332']);
37479886 367 $this->assertEquals($contribution['count'], '0', "Contribution should not be created for zero fee event registration when no price field selected.");
c91b1cc3
E
368 }
369
6d2e7dc0 370 /**
371 * Test form profile assignment.
372 *
373 * @throws \CRM_Core_Exception
374 * @throws \Exception
375 */
376 public function testAssignProfiles() {
377 $event = $this->eventCreate();
378 $this->createJoinedProfile(['entity_table' => 'civicrm_event', 'entity_id' => $event['id']]);
379
380 /* @var \CRM_Event_Form_Registration_Confirm $form */
381 $form = $this->getFormObject('CRM_Event_Form_Registration_Confirm');
382 $form->set('params', [[]]);
383 $form->set('id', $event['id']);
384 $form->set('values', [
385 'event' => $event['values'][$event['id']],
386 'location' => [],
387 'custom_pre_id' => $this->ids['UFGroup']['our profile'],
388 ]);
389 $form->preProcess();
390
391 CRM_Event_Form_Registration_Confirm::assignProfiles($form);
392
393 $smarty = CRM_Core_Smarty::singleton();
394 $tplVar = $smarty->get_template_vars();
395 $this->assertEquals([
396 'CustomPre' => ['First Name' => NULL],
397 'CustomPreGroupTitle' => 'Public title',
398 ], $tplVar['primaryParticipantProfile']);
399 }
400
eba56939
BS
401 /**
402 * Submit event registration with a note field
403 *
404 * @param array $event
405 * @param int $contact_id
406 *
407 * @throws \Exception
408 */
409 private function submitWithNote($event, $contact_id) {
410 if (empty($contact_id)) {
411 $contact_id = $this->createLoggedInUser();
412 }
413 $mut = new CiviMailUtils($this, TRUE);
414 CRM_Event_Form_Registration_Confirm::testSubmit([
415 'id' => $event['id'],
416 'contributeMode' => 'direct',
417 'registerByID' => $contact_id,
418 'custom_pre_id' => $event['custom_pre_id'],
419 'params' => [
420 [
421 'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801',
422 'entryURL' => 'http://dmaster.local/civicrm/event/register?reset=1&amp;id=3',
423 'first_name' => 'k',
424 'last_name' => 'p',
425 'email-Primary' => 'demo@example.com',
426 'hidden_processor' => '1',
427 'credit_card_number' => '4111111111111111',
428 'cvv2' => '123',
429 'credit_card_exp_date' => [
430 'M' => '1',
431 'Y' => '2019',
432 ],
433 'credit_card_type' => 'Visa',
434 'billing_first_name' => 'p',
435 'billing_middle_name' => '',
436 'billing_last_name' => 'p',
437 'billing_street_address-5' => 'p',
438 'billing_city-5' => 'p',
439 'billing_state_province_id-5' => '1061',
440 'billing_postal_code-5' => '7',
441 'billing_country_id-5' => '1228',
442 'scriptFee' => '',
443 'scriptArray' => '',
444 'priceSetId' => '6',
445 'price_7' => [
446 13 => 1,
447 ],
448 'payment_processor_id' => '1',
449 'bypass_payment' => '',
450 'MAX_FILE_SIZE' => '33554432',
451 'is_primary' => 1,
452 'is_pay_later' => 0,
453 'campaign_id' => NULL,
454 'defaultRole' => 1,
455 'participant_role_id' => '1',
456 'currencyID' => 'USD',
457 'amount_level' => '\ 1Tiny-tots (ages 5-8) - 1\ 1',
458 'amount' => '800.00',
459 'tax_amount' => NULL,
460 'year' => '2019',
461 'month' => '1',
462 'ip_address' => '127.0.0.1',
463 'invoiceID' => '57adc34957a29171948e8643ce906332',
464 'button' => '_qf_Register_upload',
465 'billing_state_province-5' => 'AP',
466 'billing_country-5' => 'US',
467 'note' => $event['note'],
468 ],
469 ],
470 ]);
471 $participant = $this->callAPISuccessGetSingle('Participant', []);
472 $mut->checkMailLog(['Comment: ' . $event['note'] . chr(0x0A)]);
473 $mut->stop();
474 $mut->clearMessages();
475 $tplVars = CRM_Core_Smarty::singleton()->get_template_vars();
476 $this->assertEquals($participant['id'], $tplVars['participantID']);
477 //return ['contact_id' => $contact_id, 'participant_id' => $participant['id']];
478 return [$contact_id, $participant['id']];
479 }
480
481 /**
482 * Create an event with a "pre" profile
483 *
484 * @throws \CRM_Core_Exception
485 * @throws \Exception
486 */
487 private function creatEventWithProfile($event) {
488 if (empty($event)) {
489 $event = $this->eventCreate();
490 $this->createJoinedProfile(['entity_table' => 'civicrm_event', 'entity_id' => $event['id']]);
491 $this->uf_field_add($this->ids["UFGroup"]["our profile"], 'note', 'Contact', 'Comment');
492 }
493
494 /* @var \CRM_Event_Form_Registration_Confirm $form */
495 $form = $this->getFormObject('CRM_Event_Form_Registration_Confirm');
496 $form->set('params', [[]]);
497 $form->set('id', $event['id']);
498 $form->set('values', [
499 'event' => $event['values'][$event['id']],
500 'location' => [],
501 'custom_pre_id' => $this->ids['UFGroup']['our profile'],
502 ]);
503 $form->preProcess();
504
505 CRM_Event_Form_Registration_Confirm::assignProfiles($form);
506
507 $smarty = CRM_Core_Smarty::singleton();
508 $tplVar = $smarty->get_template_vars();
509 $this->assertEquals([
510 'CustomPre' => ['First Name' => NULL, 'Comment' => NULL],
511 'CustomPreGroupTitle' => 'Public title',
512 ], $tplVar['primaryParticipantProfile']);
513 return $event;
514 }
515
516 /**
517 * Add a field to the specified profile
518 *
519 * @param int $uf_group_id
520 * @param string $field_name
521 * @param string $field_type
522 * @param string $field_label
523 * @return array
524 * API result array
525 */
526 private function uf_field_add($uf_group_id, $field_name, $field_type, $field_label) {
527 $params = [
528 'field_name' => $field_name,
529 'field_type' => $field_type,
530 'visibility' => 'Public Pages and Listings',
531 'weight' => 1,
532 'label' => $field_label,
533 'is_searchable' => 1,
534 'is_active' => 1,
535 'uf_group_id' => $uf_group_id,
536 ];
537 $result = civicrm_api3('UFField', 'create', $params);
538 return $result;
539 }
540
541 /**
542 * /dev/event#10
543 * Test submission with a note in the profile, ensuring the confirmation
544 * email reflects the submitted value
545 */
546 public function testNoteSubmission() {
547 //create an event with an attached profile containing a note
548 $event = $this->creatEventWithProfile(NULL);
549 $event['custom_pre_id'] = $this->ids["UFGroup"]["our profile"];
550 $event['note'] = "This is note 1";
5b6ea055 551 list($contact_id, $participant_id) = $this->submitWithNote($event, NULL);
eba56939
BS
552 civicrm_api3('Participant', 'delete', ['id' => $participant_id]);
553
554 //now that the contact has one note, register this contact again with a different note
555 //and confirm that the note shown in the email is the current one
556 $event = $this->creatEventWithProfile($event);
557 $event['custom_pre_id'] = $this->ids["UFGroup"]["our profile"];
558 $event['note'] = "This is note 2";
5b6ea055 559 list($contact_id, $participant_id) = $this->submitWithNote($event, $contact_id);
eba56939
BS
560 civicrm_api3('Participant', 'delete', ['id' => $participant_id]);
561
562 //finally, submit a blank note and confirm that the note shown in the email is blank
563 $event = $this->creatEventWithProfile($event);
564 $event['custom_pre_id'] = $this->ids["UFGroup"]["our profile"];
565 $event['note'] = "";
5b6ea055 566 list($contact_id, $participant_id) = $this->submitWithNote($event, $contact_id);
eba56939
BS
567 }
568
632196ea 569}