Swap out some additional assigns for tokens, improve tests
[civicrm-core.git] / tests / phpunit / CRM / Event / Form / SelfSvcTransferTest.php
CommitLineData
7d04a4b4
EM
1<?php
2
3/**
4 * Test CRM_Event_Form_Registration functions.
5 *
6 * @package CiviCRM
7 * @group headless
8 */
9class CRM_Event_Form_SelfSvcTransferTest extends CiviUnitTestCase {
10
11 /**
12 * Test cancellation.
13 *
14 * @throws \CRM_Core_Exception
15 * @throws \CiviCRM_API3_Exception
16 */
17 public function testCancel(): void {
18 $_REQUEST['pid'] = $this->participantCreate(['status_id' => 'Registered']);
19 $_REQUEST['is_backoffice'] = 1;
0d6fa54d 20 $this->addLocationBlockToDomain();
7d04a4b4
EM
21 $this->individualCreate(['email' => 'new@example.org']);
22 $mut = new CiviMailUtils($this);
23 /* @var CRM_Event_Form_SelfSvcTransfer $form*/
24 $form = $this->getFormObject('CRM_Event_Form_SelfSvcTransfer', [
25 'email' => 'new@example.org',
26 ]);
27 $form->buildForm();
28 $form->postProcess();
29 $emails = $mut->getAllMessages();
30 $this->assertStringContainsString('Registration Confirmation - Annual CiviCRM meet - Mr. Anthony', $emails[0]);
31 $this->assertStringContainsString('<p>Dear Anthony,</p> <p>Your Event Registration has been Transferred to Anthony Anderson.</p>', $emails[1]);
32 $this->assertStringContainsString('anthony_anderson@civicrm.org', $emails[1]);
0d6fa54d
EM
33 $this->assertStringContainsString('123', $emails[1]);
34 $this->assertStringContainsString('fixme.domainemail@example.org', $emails[1]);
7d04a4b4
EM
35 }
36
37}