4 * Test CRM_Event_Form_Registration functions.
9 class CRM_Event_Form_Task_BadgeTest
extends CiviUnitTestCase
{
11 use CRMTraits_Custom_CustomDataTrait
;
14 * Test the the submit function on the event participant submit function.
16 public function testSubmit(): void
{
17 $this->createCustomGroupWithFieldOfType(['extends' => 'Participant']);
18 $contactID = $this->individualCreate();
19 $participantID = $this->participantCreate(['contact_id' => $contactID]);
21 $_REQUEST['context'] = 'view';
22 $_REQUEST['id'] = $participantID;
23 $_REQUEST['cid'] = $contactID;
24 /* @var CRM_Event_Form_Task_Badge $form */
25 $form = $this->getFormObject(
26 'CRM_Event_Form_Task_Badge',
30 'task' => CRM_Core_Task
::BATCH_UPDATE
,
31 'radio_ts' => 'ts_sel',
32 'mark_x_' . $participantID => 1,
39 catch (CRM_Core_Exception_PrematureExitException
$e) {
40 $tokens = $e->errorData
['formattedRow']['token'];
43 'value' => 'Annual CiviCRM meet',
44 'font_name' => 'dejavusans',
47 'text_alignment' => 'L',
48 'token' => '{event.title}',
52 'value' => 'Mr. Anthony Anderson II',
53 'font_name' => 'dejavusans',
56 'text_alignment' => 'C',
57 'token' => '{contact.display_name}',
62 'font_name' => 'dejavusans',
65 'text_alignment' => 'C',
66 'token' => '{contact.current_employer}',
70 'value' => 'October 21st',
71 'font_name' => 'dejavusans',
74 'text_alignment' => 'R',
75 'token' => '{event.start_date}',
80 $this->fail('Should not be reached');