Swap out some additional assigns for tokens, improve tests
[civicrm-core.git] / tests / phpunit / CRM / Event / Form / SelfSvcUpdateTest.php
1 <?php
2
3 /**
4 * Test CRM_Event_Form_Registration functions.
5 *
6 * @package CiviCRM
7 * @group headless
8 */
9 class CRM_Event_Form_SelfSvcUpdateTest extends CiviUnitTestCase {
10
11 /**
12 * Test cancellation.
13 *
14 * @throws \CRM_Core_Exception
15 * @throws \CiviCRM_API3_Exception
16 */
17 public function testForm(): void {
18 $_REQUEST['pid'] = $this->participantCreate(['status_id' => 'Registered']);
19 $_REQUEST['is_backoffice'] = 1;
20 $this->addLocationBlockToDomain();
21 $this->individualCreate(['email' => 'new@example.org']);
22 $mut = new CiviMailUtils($this);
23 /* @var CRM_Event_Form_SelfSvcUpdate $form*/
24 $form = $this->getFormObject('CRM_Event_Form_SelfSvcUpdate', [
25 'email' => 'new@example.org',
26 'action' => 2,
27 ]);
28 $form->buildForm();
29 $form->postProcess();
30 $mut->checkAllMailLog([
31 'Your Event Registration has been cancelled',
32 'Annual CiviCRM meet',
33 'Registration Date: February 19th, 2007',
34 'Please contact us at 123 or send email to fixme.domainemail@example.org',
35 'October 21st, 2008 12:00 AM-October 23rd, 2008 12:00 AM',
36 ]);
37 $emails = $mut->getAllMessages();
38 $this->assertStringContainsString('', $emails[0]);
39 }
40
41 }