fa839a68 |
1 | <?php |
2 | |
3 | /** |
4 | * Test CRM_Event_Form_Registration functions. |
5 | * |
6 | * @package CiviCRM |
7 | * @group headless |
8 | */ |
9 | class CRM_Event_Form_Task_ParticipantStatusTest extends CiviUnitTestCase { |
10 | |
11 | /** |
12 | * Test the the submit function on the event participant submit function. |
13 | * |
14 | * @todo extract submit functions on other Batch update classes, use dataprovider to test on all. |
15 | */ |
16 | public function testSubmit() { |
17 | $group = $this->customGroupCreate(['extends' => 'Participant', 'title' => 'Participant']); |
18 | $field = $this->customFieldCreate(['custom_group_id' => $group['id'], 'html_type' => 'CheckBox', 'option_values' => ['two' => 'A couple', 'three' => 'A few', 'four' => 'Too Many']]); |
19 | $participantID = $this->participantCreate(); |
20 | $participant = $this->callAPISuccessGetSingle('Participant', ['id' => $participantID]); |
21 | $this->assertEquals(2, $participant['participant_status_id']); |
22 | |
23 | $form = $this->getFormObject('CRM_Event_Form_Task_Batch'); |
24 | $form->submit(['field' => [$participantID => ['participant_status_id' => 1, 'custom_' . $field['id'] => ['two' => 1, 'four' => 1]]]]); |
25 | |
26 | $participant = $this->callAPISuccessGetSingle('Participant', ['id' => $participantID]); |
27 | $this->assertEquals(1, $participant['participant_status_id']); |
28 | } |
29 | |
30 | } |