3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * Test class for Batch API - civicrm_participant_*
31 * @package CiviCRM_APIv3
33 require_once 'CRM/Utils/DeprecatedUtils.php';
37 * Class api_v3_ParticipantTest
40 class api_v3_ParticipantTest
extends CiviUnitTestCase
{
42 protected $_apiversion;
44 protected $_contactID;
45 protected $_contactID2;
46 protected $_createdParticipants;
47 protected $_participantID;
49 protected $_individualId;
52 public function setUp() {
53 $this->_apiversion
= 3;
55 $this->_entity
= 'participant';
56 $event = $this->eventCreate(NULL);
57 $this->_eventID
= $event['id'];
59 $this->_contactID
= $this->individualCreate();
61 $this->_createdParticipants
= array();
62 $this->_individualId
= $this->individualCreate();
64 $this->_participantID
= $this->participantCreate(array(
65 'contact_id' => $this->_contactID
,
66 'event_id' => $this->_eventID
,
68 $this->_contactID2
= $this->individualCreate();
69 $this->_participantID2
= $this->participantCreate(array(
70 'contact_id' => $this->_contactID2
,
71 'event_id' => $this->_eventID
,
72 'registered_by_id' => $this->_participantID
,
74 $this->_participantID3
= $this->participantCreate(array(
75 'contact_id' => $this->_contactID2
,
76 'event_id' => $this->_eventID
,
78 $this->_params
= array(
79 'contact_id' => $this->_contactID
,
80 'event_id' => $this->_eventID
,
83 // to ensure it matches later on
84 'register_date' => '2007-07-21 00:00:00',
85 'source' => 'Online Event Registration: API Testing',
89 public function tearDown() {
90 $this->eventDelete($this->_eventID
);
91 $tablesToTruncate = array(
92 'civicrm_custom_group',
93 'civicrm_custom_field',
95 'civicrm_participant',
97 // true tells quickCleanup to drop any tables that might have been created in the test
98 $this->quickCleanup($tablesToTruncate, TRUE);
102 * Test get participants with role_id.
104 public function testGetParticipantWithRole() {
105 $roleId = array(1, 2, 3);
106 foreach ($roleId as $role) {
107 $this->participantCreate(array(
108 'contact_id' => $this->individualCreate(),
110 'event_id' => $this->_eventID
,
117 $result = $this->callAPISuccess('participant', 'get', $params);
118 //Assert all the returned participants has a role_id of 2
119 foreach ($result['values'] as $pid => $values) {
120 $this->assertEquals($values['participant_role_id'], 2);
123 $this->participantCreate(array(
124 'id' => $this->_participantID
,
126 'event_id' => $this->_eventID
,
129 $params['role_id'] = array(
132 $result = $this->callAPISuccess('participant', 'get', $params);
133 foreach ($result['values'] as $pid => $values) {
134 $this->assertEquals($values['participant_role_id'], NULL);
140 * Check with complete array + custom field
141 * Note that the test is written on purpose without any
142 * variables specific to participant so it can be replicated into other entities
143 * and / or moved to the automated test suite
145 public function testCreateWithCustom() {
146 $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__
, __FILE__
);
148 $params = $this->_params
;
149 $params['custom_' . $ids['custom_field_id']] = "custom string";
151 $result = $this->callAPIAndDocument($this->_entity
, 'create', $params, __FUNCTION__
, __FILE__
);
153 $this->assertEquals($result['id'], $result['values'][$result['id']]['id']);
155 $check = $this->callAPISuccess($this->_entity
, 'get', array('id' => $result['id']));
156 $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__
);
158 $this->customFieldDelete($ids['custom_field_id']);
159 $this->customGroupDelete($ids['custom_group_id']);
163 ///////////////// civicrm_participant_get methods
166 * Check with wrong params type.
168 public function testGetWrongParamsType() {
169 $params = 'a string';
170 $result = $this->callAPIFailure('participant', 'get', $params);
174 * Test civicrm_participant_get with empty params.
176 public function testGetEmptyParams() {
177 $this->callAPISuccess('participant', 'get', array());
181 * Check with participant_id.
183 public function testGetParticipantIdOnly() {
185 'participant_id' => $this->_participantID
,
189 'participant_register_date',
190 'participant_source',
193 $result = $this->callAPISuccess('participant', 'get', $params);
194 $this->assertAPISuccess($result, " in line " . __LINE__
);
195 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
, "in line " . __LINE__
);
196 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00', "in line " . __LINE__
);
197 $this->assertEquals($result['values'][$this->_participantID
]['participant_source'], 'Wimbeldon', "in line " . __LINE__
);
199 'id' => $this->_participantID
,
200 'return' => 'id,participant_register_date,event_id',
203 $result = $this->callAPISuccess('participant', 'get', $params);
204 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
);
205 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
210 * Test permission for participant get.
212 public function testGetParticipantWithPermission() {
213 $config = CRM_Core_Config
::singleton();
214 $config->userPermissionClass
->permissions
= array();
216 'event_id' => $this->_eventID
,
217 'check_permissions' => TRUE,
221 'participant_register_date',
222 'participant_source',
225 $this->callAPIFailure('participant', 'get', $params);
227 $params['check_permissions'] = FALSE;
228 $result = $this->callAPISuccess('participant', 'get', $params);
229 $this->assertEquals($result['is_error'], 0);
234 * Check with params id.
236 public function testGetParamsAsIdOnly() {
238 'id' => $this->_participantID
,
240 $result = $this->callAPIAndDocument('participant', 'get', $params, __FUNCTION__
, __FILE__
);
241 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
);
242 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
243 $this->assertEquals($result['values'][$this->_participantID
]['participant_source'], 'Wimbeldon');
244 $this->assertEquals($result['id'], $result['values'][$this->_participantID
]['id']);
248 * Check with params id.
250 public function testGetNestedEventGet() {
251 //create a second event & add participant to it.
252 $event = $this->eventCreate(NULL);
253 $this->callAPISuccess('participant', 'create', array(
254 'event_id' => $event['id'],
255 'contact_id' => $this->_contactID
,
258 $description = "Demonstrates use of nested get to fetch event data with participant records.";
259 $subfile = "NestedEventGet";
261 'id' => $this->_participantID
,
262 'api.event.get' => 1,
264 $result = $this->callAPIAndDocument('participant', 'get', $params, __FUNCTION__
, __FILE__
, $description, $subfile);
265 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
);
266 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
267 $this->assertEquals($result['values'][$this->_participantID
]['participant_source'], 'Wimbeldon');
268 $this->assertEquals($this->_eventID
, $result['values'][$this->_participantID
]['api.event.get']['id']);
272 * Check Participant Get respects return properties.
274 public function testGetWithReturnProperties() {
276 'contact_id' => $this->_contactID
,
277 'return.status_id' => 1,
278 'return.participant_status_id' => 1,
279 'options' => array('limit' => 1),
281 $result = $this->callAPISuccess('participant', 'get', $params);
282 $this->assertArrayHasKey('participant_status_id', $result['values'][$result['id']]);
286 * Check with contact_id.
288 public function testGetContactIdOnly() {
290 'contact_id' => $this->_contactID
,
292 $participant = $this->callAPISuccess('participant', 'get', $params);
294 $this->assertEquals($this->_participantID
, $participant['id'],
295 "In line " . __LINE__
297 $this->assertEquals($this->_eventID
, $participant['values'][$participant['id']]['event_id'],
298 "In line " . __LINE__
300 $this->assertEquals('2007-02-19 00:00:00', $participant['values'][$participant['id']]['participant_register_date'],
301 "In line " . __LINE__
303 $this->assertEquals('Wimbeldon', $participant['values'][$participant['id']]['participant_source'],
304 "In line " . __LINE__
306 $this->assertEquals($participant['id'], $participant['values'][$participant['id']]['id'],
307 "In line " . __LINE__
312 * Check with event_id.
315 public function testGetMultiMatchReturnFirst() {
317 'event_id' => $this->_eventID
,
321 $participant = $this->callAPISuccess('participant', 'get', $params);
322 $this->assertNotNull($participant['id']);
326 * Check with event_id.
327 * in v3 this should return all participants
329 public function testGetMultiMatchNoReturnFirst() {
331 'event_id' => $this->_eventID
,
333 $participant = $this->callAPISuccess('participant', 'get', $params);
334 $this->assertNotNull($participant['count'], 3);
337 ///////////////// civicrm_participant_get methods
340 * Test civicrm_participant_get with empty params.
341 * In this case all the participant records are returned.
343 public function testSearchEmptyParams() {
344 $result = $this->callAPISuccess('participant', 'get', array());
345 // expecting 3 participant records
346 $this->assertEquals($result['count'], 3);
350 * Check with participant_id.
352 public function testSearchParticipantIdOnly() {
354 'participant_id' => $this->_participantID
,
356 $participant = $this->callAPISuccess('participant', 'get', $params);
357 $this->assertEquals($participant['values'][$this->_participantID
]['event_id'], $this->_eventID
);
358 $this->assertEquals($participant['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
359 $this->assertEquals($participant['values'][$this->_participantID
]['participant_source'], 'Wimbeldon');
363 * Check with contact_id.
365 public function testSearchContactIdOnly() {
366 // Should get 2 participant records for this contact.
368 'contact_id' => $this->_contactID2
,
370 $participant = $this->callAPISuccess('participant', 'get', $params);
372 $this->assertEquals($participant['count'], 2);
376 * Check with event_id.
378 public function testSearchByEvent() {
379 // Should get >= 3 participant records for this event. Also testing that last_name and event_title are returned.
381 'event_id' => $this->_eventID
,
382 'return.last_name' => 1,
383 'return.event_title' => 1,
385 $participant = $this->callAPISuccess('participant', 'get', $params);
386 if ($participant['count'] < 3) {
387 $this->fail("Event search returned less than expected miniumum of 3 records.");
390 $this->assertEquals($participant['values'][$this->_participantID
]['last_name'], 'Anderson');
391 $this->assertEquals($participant['values'][$this->_participantID
]['event_title'], 'Annual CiviCRM meet');
395 * Check with event_id.
398 public function testSearchByEventWithLimit() {
399 // Should 2 participant records since we're passing rowCount = 2.
401 'event_id' => $this->_eventID
,
404 $participant = $this->callAPISuccess('participant', 'get', $params);
406 $this->assertEquals($participant['count'], 2);
410 * Test search by lead booker (registered by ID)
412 public function testSearchByRegisteredById() {
414 'registered_by_id' => $this->_participantID
,
416 $participant = $this->callAPISuccess('participant', 'get', $params);
418 $this->assertEquals($participant['count'], 1);
419 $this->assertEquals($participant['id'], $this->_participantID2
);
422 ///////////////// civicrm_participant_create methods
425 * Test civicrm_participant_create with empty params.
427 public function testCreateEmptyParams() {
429 $result = $this->callAPIFailure('participant', 'create', $params);
433 * Check with event_id.
435 public function testCreateMissingContactID() {
437 'event_id' => $this->_eventID
,
439 $participant = $this->callAPIFailure('participant', 'create', $params);
443 * Check with contact_id.
446 public function testCreateMissingEventID() {
448 'contact_id' => $this->_contactID
,
450 $participant = $this->callAPIFailure('participant', 'create', $params);
454 * Check with contact_id & event_id
456 public function testCreateEventIdOnly() {
458 'contact_id' => $this->_contactID
,
459 'event_id' => $this->_eventID
,
461 $participant = $this->callAPISuccess('participant', 'create', $params);
462 $this->getAndCheck($params, $participant['id'], 'participant');
466 * Check with complete array.
468 public function testCreateAllParams() {
469 $params = $this->_params
;
471 $participant = $this->callAPISuccess('participant', 'create', $params);
472 $this->_participantID
= $participant['id'];
473 // assertDBState compares expected values in $match to actual values in the DB
474 $this->assertDBState('CRM_Event_DAO_Participant', $participant['id'], $params);
478 * Test to check if receive date is being changed per CRM-9763
480 public function testCreateUpdateReceiveDate() {
481 $participant = $this->callAPISuccess('participant', 'create', $this->_params
);
483 'id' => $participant['id'],
486 $this->callAPISuccess('participant', 'create', $update);
487 $this->getAndCheck(array_merge($this->_params
, $update), $participant['id'], 'participant');
491 * Test to check if participant fee level is being changed per CRM-9781
493 public function testCreateUpdateParticipantFeeLevel() {
494 $myParams = $this->_params +
array('participant_fee_level' => CRM_Core_DAO
::VALUE_SEPARATOR
. "fee" . CRM_Core_DAO
::VALUE_SEPARATOR
);
495 $participant = $this->callAPISuccess('participant', 'create', $myParams);
497 'id' => $participant['id'],
500 $update = $this->callAPISuccess('participant', 'create', $update);
502 $this->assertEquals($participant['values'][$participant['id']]['fee_level'],
503 $update['values'][$participant['id']]['fee_level']
506 $this->callAPISuccess('participant', 'delete', array('id' => $participant['id']));
510 * Test the line items for participant fee with multiple price field values.
512 public function testCreateParticipantLineItems() {
513 // Create a price set for this event.
515 $priceset = $this->callAPISuccess('PriceSet', 'create', array(
516 'name' => 'my_price_set',
517 'title' => 'My Price Set',
520 'financial_type_id' => 4,
521 // 'entity' => array('civicrm_event' => array($this->_eventID)),
524 // Add the price set to the event with another API call.
525 // I tried to do this at once, but it did not work.
527 $priceset = $this->callAPISuccess('PriceSet', 'create', array(
528 'entity_table' => 'civicrm_event',
529 'entity_id' => $this->_eventID
,
530 'id' => $priceset['id'],
533 $pricefield = $this->callAPISuccess('PriceField', 'create', array(
534 'price_set_id' => $priceset['id'],
535 'name' => 'mypricefield',
536 'label' => 'My Price Field',
537 'html_type' => 'Text',
539 'is_display_amounts' => 1,
543 $pfv1 = $this->callAPISuccess('PriceFieldValue', 'create', array(
544 'price_field_id' => $pricefield['id'],
545 'name' => 'pricefieldvalue1',
546 'label' => 'pricefieldvalue1',
549 'financial_type_id' => 4,
552 $pfv2 = $this->callAPISuccess('PriceFieldValue', 'create', array(
553 'price_field_id' => $pricefield['id'],
554 'name' => 'pricefieldvalue2',
555 'label' => 'pricefieldvalue2',
558 'financial_type_id' => 4,
561 // pay 2 times price field value 1, and 2 times price field value 2.
562 $myParams = $this->_params +
array('participant_fee_level' => CRM_Core_DAO
::VALUE_SEPARATOR
. "pricefieldvalue1 - 2" . CRM_Core_DAO
::VALUE_SEPARATOR
. "pricefieldvalue2 - 2" . CRM_Core_DAO
::VALUE_SEPARATOR
);
563 $participant = $this->callAPISuccess('participant', 'create', $myParams);
565 // expect 2 line items.
566 $lineItems = $this->callAPISuccess('LineItem', 'get', array(
567 'entity_id' => $participant['id'],
568 'entity_table' => 'civicrm_participant',
571 $this->assertEquals(2, $lineItems['count']);
573 // Check quantity, label and unit price of lines.
574 // TODO: These assertions depend on the order of the line items, which is
575 // technically incorrect.
577 $lineItem = array_pop($lineItems['values']);
578 $this->assertEquals(2, $lineItem['qty']);
579 $this->assertEquals(5, $lineItem['unit_price']);
580 $this->assertEquals('pricefieldvalue2', $lineItem['label']);
582 $lineItem = array_pop($lineItems['values']);
583 $this->assertEquals(2, $lineItem['qty']);
584 $this->assertEquals(20, $lineItem['unit_price']);
585 $this->assertEquals('pricefieldvalue1', $lineItem['label']);
588 $this->callAPISuccess('participant', 'delete', array('id' => $participant['id']));
590 // TODO: I think the price set should be removed, but I don't know how
591 // to decouple it properly from the event. For the moment, I'll just comment
592 // out the lines below.
595 $this->callAPISuccess('PriceFieldValue', 'delete', array('id' => $pfv1['id']));
596 $this->callAPISuccess('PriceFieldValue', 'delete', array('id' => $pfv2['id']));
597 $this->callAPISuccess('PriceField', 'delete', array('id' => $pricefield['id']));
598 $this->callAPISuccess('PriceSet', 'delete', array('id' => $priceset['id']));
603 * Check with complete array.
605 public function testUpdate() {
606 $participantId = $this->participantCreate(array(
607 'contactID' => $this->_individualId
,
608 'eventID' => $this->_eventID
,
611 'id' => $participantId,
612 'contact_id' => $this->_individualId
,
613 'event_id' => $this->_eventID
,
616 'register_date' => '2006-01-21',
617 'source' => 'US Open',
619 $participant = $this->callAPISuccess('participant', 'create', $params);
620 $this->getAndCheck($params, $participant['id'], 'participant');
621 $result = $this->participantDelete($params['id']);
625 * Test to check if participant fee level is being changed per CRM-9781
626 * Try again without a custom separater to check that one isn't added
627 * (get & check won't accept an array)
629 public function testUpdateCreateParticipantFeeLevelNoSeparator() {
631 $myParams = $this->_params +
array('participant_fee_level' => "fee");
632 $participant = $this->callAPISuccess('participant', 'create', $myParams);
633 $this->assertAPISuccess($participant);
635 'id' => $participant['id'],
638 $this->callAPISuccess('participant', 'create', $update);
639 $this->assertEquals($participant['values'][$participant['id']]['fee_level'],
640 $myParams['participant_fee_level']
642 $this->getAndCheck($update, $participant['id'], 'participant');
644 ///////////////// civicrm_participant_update methods
647 * Test civicrm_participant_update with wrong params type.
649 public function testUpdateWrongParamsType() {
650 $params = 'a string';
651 $result = $this->callAPIFailure('participant', 'create', $params);
652 $this->assertEquals('Input variable `params` is not an array', $result['error_message']);
656 * Check with empty array.
658 public function testUpdateEmptyParams() {
660 $participant = $this->callAPIFailure('participant', 'create', $params);
661 $this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id, contact_id');
665 * Check without event_id.
667 public function testUpdateWithoutEventId() {
668 $participantId = $this->participantCreate(array('contactID' => $this->_individualId
, 'eventID' => $this->_eventID
));
670 'contact_id' => $this->_individualId
,
673 'register_date' => '2006-01-21',
674 'source' => 'US Open',
675 'event_level' => 'Donation',
677 $participant = $this->callAPIFailure('participant', 'create', $params);
678 $this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id');
679 // Cleanup created participant records.
680 $result = $this->participantDelete($participantId);
684 * Check with Invalid participantId.
686 public function testUpdateWithWrongParticipantId() {
691 'register_date' => '2006-01-21',
692 'source' => 'US Open',
693 'event_level' => 'Donation',
695 $participant = $this->callAPIFailure('Participant', 'update', $params);
699 * Check with Invalid ContactId.
701 public function testUpdateWithWrongContactId() {
702 $participantId = $this->participantCreate(array(
703 'contactID' => $this->_individualId
,
704 'eventID' => $this->_eventID
,
705 ), $this->_apiversion
);
707 'id' => $participantId,
708 'contact_id' => 12345,
711 'register_date' => '2006-01-21',
712 'source' => 'US Open',
713 'event_level' => 'Donation',
715 $participant = $this->callAPIFailure('participant', 'create', $params);
716 $result = $this->participantDelete($participantId);
719 ///////////////// civicrm_participant_delete methods
722 * Test civicrm_participant_delete with wrong params type.
724 public function testDeleteWrongParamsType() {
725 $params = 'a string';
726 $result = $this->callAPIFailure('participant', 'delete', $params);
730 * Test civicrm_participant_delete with empty params.
732 public function testDeleteEmptyParams() {
734 $result = $this->callAPIFailure('participant', 'delete', $params);
738 * Check with participant_id.
740 public function testParticipantDelete() {
742 'id' => $this->_participantID
,
744 $participant = $this->callAPISuccess('participant', 'delete', $params);
745 $this->assertAPISuccess($participant);
746 $this->assertDBState('CRM_Event_DAO_Participant', $this->_participantID
, NULL, TRUE);
750 * Check without participant_id.
752 * This should return an error because required param is missing..
754 public function testParticipantDeleteMissingID() {
756 'event_id' => $this->_eventID
,
758 $participant = $this->callAPIFailure('participant', 'delete', $params);
759 $this->assertNotNull($participant['error_message']);
763 * Delete with a get - a 'criteria delete'
765 public function testNestedDelete() {
766 $description = "Criteria delete by nesting a GET & a DELETE.";
767 $subfile = "NestedDelete";
768 $participants = $this->callAPISuccess('Participant', 'Get', array());
769 $this->assertEquals($participants['count'], 3);
770 $params = array('contact_id' => $this->_contactID2
, 'api.participant.delete' => 1);
771 $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__
, __FILE__
, $description, $subfile);
772 $check = $this->callAPISuccess('participant', 'getcount', array());
773 $this->assertEquals(1, $check, "only one participant should be left. line " . __LINE__
);
777 * Test creation of a participant with an associated contribution.
779 public function testCreateParticipantWithPayment() {
780 $description = "Single function to create contact with partipation & contribution.
781 Note that in the case of 'contribution' the 'create' is implied (api.contribution.create)";
782 $subfile = "CreateParticipantPayment";
784 'contact_type' => 'Individual',
785 'display_name' => 'dlobo',
786 'api.participant' => array(
787 'event_id' => $this->_eventID
,
790 'format.only_id' => 1,
792 'api.contribution.create' => array(
793 'financial_type_id' => 1,
794 'total_amount' => 100,
795 'format.only_id' => 1,
797 'api.participant_payment.create' => array(
798 'contribution_id' => '$value.api.contribution.create',
799 'participant_id' => '$value.api.participant',
803 $result = $this->callAPIAndDocument('contact', 'create', $params, __FUNCTION__
, __FILE__
, $description, $subfile);
804 $this->assertEquals(1, $result['values'][$result['id']]['api.participant_payment.create']['count']);
805 $this->callAPISuccess('contact', 'delete', array('id' => $result['id']));
809 * Test participant invoke post hook after status update.
811 public function testPostHookForAdditionalParticipant() {
812 $participantID = $this->participantCreate(array(
813 'contact_id' => $this->_contactID
,
815 'event_id' => $this->_eventID
,
817 $participantID2 = $this->participantCreate(array(
818 'contact_id' => $this->_contactID2
,
819 'event_id' => $this->_eventID
,
821 'registered_by_id' => $participantID,
824 $this->hookClass
->setHook('civicrm_post', array($this, 'onPost'));
826 'id' => $participantID,
829 $this->callAPISuccess('Participant', 'create', $params);
831 $result = $this->callAPISuccess('Participant', 'get', array('source' => 'Post Hook Update'));
832 $this->assertEquals(2, $result['count']);
834 $expected = array($participantID, $participantID2);
835 $actual = array_keys($result['values']);
836 $this->checkArrayEquals($expected, $actual);