8027e3da645250c93d4977550fbbd7dc196f5840
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.3 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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 +--------------------------------------------------------------------+
28 require_once 'CiviTest/CiviUnitTestCase.php';
31 * Test class for Batch API - civicrm_participant_*
33 * @package CiviCRM_APIv3
35 require_once 'CRM/Utils/DeprecatedUtils.php';
36 require_once 'CiviTest/CiviUnitTestCase.php';
37 class api_v3_ParticipantTest
extends CiviUnitTestCase
{
39 protected $_apiversion;
41 protected $_contactID;
42 protected $_contactID2;
43 protected $_createdParticipants;
44 protected $_participantID;
46 protected $_individualId;
48 public $_eNoticeCompliant = FALSE;
52 'name' => 'Participant Create',
53 'description' => 'Test all Participant Create API methods.',
54 'group' => 'CiviCRM API Tests',
59 $this->_apiversion
= 3;
61 $this->_entity
= 'participant';
62 $event = $this->eventCreate(NULL);
63 $this->_eventID
= $event['id'];
65 $this->_contactID
= $this->individualCreate(NULL);
67 $this->_createdParticipants
= array();
68 $this->_individualId
= $this->individualCreate(NULL);
70 $this->_participantID
= $this->participantCreate(array('contactID' => $this->_contactID
, 'eventID' => $this->_eventID
));
71 $this->_contactID2
= $this->individualCreate(NULL);
72 $this->_participantID2
= $this->participantCreate(array('contactID' => $this->_contactID2
, 'eventID' => $this->_eventID
, 'version' => $this->_apiversion
));
73 $this->_participantID3
= $this->participantCreate(array('contactID' => $this->_contactID2
, 'eventID' => $this->_eventID
, 'version' => $this->_apiversion
));
74 $this->_params
= array(
75 'contact_id' => $this->_contactID
,
76 'event_id' => $this->_eventID
,
79 // to ensure it matches later on
80 'register_date' => '2007-07-21 00:00:00',
81 'source' => 'Online Event Registration: API Testing',
82 'version' => $this->_apiversion
,
87 $this->eventDelete($this->_eventID
);
88 $tablesToTruncate = array(
89 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_contact', 'civicrm_participant'
91 // true tells quickCleanup to drop any tables that might have been created in the test
92 $this->quickCleanup($tablesToTruncate, TRUE);
96 * check with complete array + custom field
97 * Note that the test is written on purpose without any
98 * variables specific to participant so it can be replicated into other entities
99 * and / or moved to the automated test suite
101 function testCreateWithCustom() {
102 $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__
, __FILE__
);
104 $params = $this->_params
;
105 $params['custom_' . $ids['custom_field_id']] = "custom string";
107 $result = civicrm_api($this->_entity
, 'create', $params);
108 $this->assertEquals($result['id'], $result['values'][$result['id']]['id']);
109 $this->documentMe($params, $result, __FUNCTION__
, __FILE__
);
110 $this->assertAPISuccess($result);
112 $check = civicrm_api($this->_entity
, 'get', array('version' => 3, 'id' => $result['id']));
113 $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__
);
115 $this->customFieldDelete($ids['custom_field_id']);
116 $this->customGroupDelete($ids['custom_group_id']);
120 ///////////////// civicrm_participant_get methods
123 * check with wrong params type
125 function testGetWrongParamsType() {
126 $params = 'a string';
127 $result = civicrm_api('participant', 'get', $params);
129 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
133 * Test civicrm_participant_get with empty params
135 function testGetEmptyParams() {
137 $result = civicrm_api('participant', 'get', $params);
139 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
143 * check with participant_id
145 function testGetParticipantIdOnly() {
147 'participant_id' => $this->_participantID
,
148 'version' => $this->_apiversion
,
152 'participant_register_date',
153 'participant_source',
156 $result = civicrm_api('participant', 'get', $params);
157 $this->assertAPISuccess($result, " in line " . __LINE__
);
158 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
, "in line " . __LINE__
);
159 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00', "in line " . __LINE__
);
160 $this->assertEquals($result['values'][$this->_participantID
]['participant_source'], 'Wimbeldon', "in line " . __LINE__
);
162 'id' => $this->_participantID
,
163 'version' => $this->_apiversion
,
164 'return' => 'id,participant_register_date,event_id',
167 $result = civicrm_api('participant', 'get', $params);
168 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
);
169 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
174 * check with params id
176 function testGetParamsAsIdOnly() {
178 'id' => $this->_participantID
,
179 'version' => $this->_apiversion
,
181 $result = civicrm_api('participant', 'get', $params);
182 $this->documentMe($params, $result, __FUNCTION__
, __FILE__
);
183 $this->assertAPISuccess($result);
184 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
);
185 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
186 $this->assertEquals($result['values'][$this->_participantID
]['participant_source'], 'Wimbeldon');
187 $this->assertEquals($result['id'], $result['values'][$this->_participantID
]['id']);
191 * check with params id
193 function testGetNestedEventGet() {
194 //create a second event & add participant to it.
195 $event = $this->eventCreate(NULL);
196 civicrm_api('participant', 'create', array('version' => 3, 'event_id' => $event['id'], 'contact_id' => $this->_contactID
));
199 $description = "use nested get to get an event";
200 $subfile = "NestedEventGet";
202 'id' => $this->_participantID
,
203 'version' => $this->_apiversion
,
204 'api.event.get' => 1,
206 $result = civicrm_api('participant', 'get', $params);
207 $this->documentMe($params, $result, __FUNCTION__
, __FILE__
, $description, $subfile);
208 $this->assertAPISuccess($result);
209 $this->assertEquals($result['values'][$this->_participantID
]['event_id'], $this->_eventID
);
210 $this->assertEquals($result['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
211 $this->assertEquals($result['values'][$this->_participantID
]['participant_source'], 'Wimbeldon');
212 $this->assertEquals($this->_eventID
, $result['values'][$this->_participantID
]['api.event.get']['id']);
215 * Check Participant Get respects return properties
217 function testGetWithReturnProperties() {
219 'contact_id' => $this->_contactID
,
220 'version' => $this->_apiversion
,
221 'return.status_id' => 1,
222 'return.participant_status_id' => 1,
223 'options' => array('limit' => 1)
225 $result = civicrm_api('participant', 'get', $params);
226 $this->assertArrayHasKey('participant_status_id', $result['values'][$result['id']]);
230 * check with contact_id
232 function testGetContactIdOnly() {
234 'contact_id' => $this->_contactID
,
235 'version' => $this->_apiversion
,
237 $participant = civicrm_api('participant', 'get', $params);
239 $this->assertEquals($this->_participantID
, $participant['id'],
240 "In line " . __LINE__
242 $this->assertEquals($this->_eventID
, $participant['values'][$participant['id']]['event_id'],
243 "In line " . __LINE__
245 $this->assertEquals('2007-02-19 00:00:00', $participant['values'][$participant['id']]['participant_register_date'],
246 "In line " . __LINE__
248 $this->assertEquals('Wimbeldon', $participant['values'][$participant['id']]['participant_source'],
249 "In line " . __LINE__
251 $this->assertEquals($participant['id'], $participant['values'][$participant['id']]['id'],
252 "In line " . __LINE__
257 * check with event_id
260 function testGetMultiMatchReturnFirst() {
262 'event_id' => $this->_eventID
,
264 'version' => $this->_apiversion
,
267 $participant = civicrm_api('participant', 'get', $params);
268 $this->assertNotNull($participant['id']);
272 * check with event_id
273 * in v3 this should return all participants
275 function testGetMultiMatchNoReturnFirst() {
277 'event_id' => $this->_eventID
,
278 'version' => $this->_apiversion
,
280 $participant = civicrm_api('participant', 'get', $params);
281 $this->assertEquals($participant['is_error'], 0);
282 $this->assertNotNull($participant['count'], 3);
285 ///////////////// civicrm_participant_get methods
288 * Test civicrm_participant_get with wrong params type
290 function testSearchWrongParamsType() {
291 $params = 'a string';
292 $result = civicrm_api('participant', 'get', $params);
294 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
298 * Test civicrm_participant_get with empty params
299 * In this case all the participant records are returned.
301 function testSearchEmptyParams() {
302 $params = array('version' => $this->_apiversion
);
303 $result = civicrm_api('participant', 'get', $params);
305 // expecting 3 participant records
306 $this->assertEquals($result['count'], 3);
310 * check with participant_id
312 function testSearchParticipantIdOnly() {
314 'participant_id' => $this->_participantID
,
315 'version' => $this->_apiversion
,
317 $participant = civicrm_api('participant', 'get', $params);
318 $this->assertEquals($participant['values'][$this->_participantID
]['event_id'], $this->_eventID
);
319 $this->assertEquals($participant['values'][$this->_participantID
]['participant_register_date'], '2007-02-19 00:00:00');
320 $this->assertEquals($participant['values'][$this->_participantID
]['participant_source'], 'Wimbeldon');
324 * check with contact_id
326 function testSearchContactIdOnly() {
327 // Should get 2 participant records for this contact.
329 'contact_id' => $this->_contactID2
,
330 'version' => $this->_apiversion
,
332 $participant = civicrm_api('participant', 'get', $params);
334 $this->assertEquals($participant['count'], 2);
338 * check with event_id
340 function testSearchByEvent() {
341 // Should get >= 3 participant records for this event. Also testing that last_name and event_title are returned.
343 'event_id' => $this->_eventID
,
344 'return.last_name' => 1,
345 'return.event_title' => 1,
346 'version' => $this->_apiversion
,
348 $participant = civicrm_api('participant', 'get', $params);
349 if ($participant['count'] < 3) {
350 $this->fail("Event search returned less than expected miniumum of 3 records.");
353 $this->assertEquals($participant['values'][$this->_participantID
]['last_name'], 'Anderson');
354 $this->assertEquals($participant['values'][$this->_participantID
]['event_title'], 'Annual CiviCRM meet');
358 * check with event_id
361 function testSearchByEventWithLimit() {
362 // Should 2 participant records since we're passing rowCount = 2.
364 'event_id' => $this->_eventID
,
366 'version' => $this->_apiversion
,
368 $participant = civicrm_api('participant', 'get', $params);
370 $this->assertEquals($participant['count'], 2, 'in line ' . __LINE__
);
373 ///////////////// civicrm_participant_create methods
376 * Test civicrm_participant_create with wrong params type
378 function testCreateWrongParamsType() {
379 $params = 'a string';
380 $result = civicrm_api('participant', 'create', $params);
382 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
386 * Test civicrm_participant_create with empty params
388 function testCreateEmptyParams() {
390 $result = civicrm_api('participant', 'create', $params);
392 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
396 * check with event_id
398 function testCreateMissingContactID() {
400 'event_id' => $this->_eventID
,
401 'version' => $this->_apiversion
,
403 $participant = civicrm_api('participant', 'create', $params);
404 if (CRM_Utils_Array
::value('id', $participant)) {
405 $this->_createdParticipants
[] = $participant['id'];
407 $this->assertEquals($participant['is_error'], 1);
408 $this->assertNotNull($participant['error_message']);
412 * check with contact_id
415 function testCreateMissingEventID() {
417 'contact_id' => $this->_contactID
,
418 'version' => $this->_apiversion
,
420 $participant = civicrm_api('participant', 'create', $params);
421 if (CRM_Utils_Array
::value('id', $participant)) {
422 $this->_createdParticipants
[] = $participant['id'];
424 $this->assertEquals($participant['is_error'], 1);
425 $this->assertNotNull($participant['error_message']);
429 * check with contact_id & event_id
431 function testCreateEventIdOnly() {
433 'contact_id' => $this->_contactID
,
434 'event_id' => $this->_eventID
,
435 'version' => $this->_apiversion
,
437 $participant = civicrm_api('participant', 'create', $params);
438 $this->assertAPISuccess($participant);
439 $this->_participantID
= $participant['id'];
441 if (!$participant['is_error']) {
442 // assertDBState compares expected values in $match to actual values in the DB
443 unset($params['version']);
444 $this->assertDBState('CRM_Event_DAO_Participant', $participant['id'], $params);
449 * check with complete array
451 function testCreateAllParams() {
452 $params = $this->_params
;
454 $participant = civicrm_api('participant', 'create', $params);
455 $this->assertNotEquals($participant['is_error'], 1, 'in line ' . __LINE__
);
456 $this->_participantID
= $participant['id'];
457 if (!$participant['is_error']) {
458 // assertDBState compares expected values in $match to actual values in the DB
459 unset($params['version']);
460 $this->assertDBState('CRM_Event_DAO_Participant', $participant['id'], $params);
464 * Test to check if receive date is being changed per CRM-9763
466 function testCreateUpdateReceiveDate() {
467 $participant = civicrm_api('participant', 'create', $this->_params
);
470 'id' => $participant['id'],
473 civicrm_api('participant', 'create', $update);
474 $this->getAndCheck(array_merge($this->_params
, $update), $participant['id'], 'participant');
477 * Test to check if participant fee level is being changed per CRM-9781
479 function testCreateUpdateParticipantFeeLevel() {
480 $myParams = $this->_params +
array('participant_fee_level' => CRM_Core_DAO
::VALUE_SEPARATOR
. "fee" . CRM_Core_DAO
::VALUE_SEPARATOR
);
481 $participant = civicrm_api('participant', 'create', $myParams);
482 $this->assertAPISuccess($participant);
485 'id' => $participant['id'],
488 civicrm_api('participant', 'create', $update);
489 $this->assertEquals($participant['values'][$participant['id']]['participant_fee_level'],
490 $update['values'][$participant['id']]['participant_fee_level']
493 civicrm_api('participant', 'delete', array('version' => 3, 'id' => $participant['id']));
496 * Test to check if participant fee level is being changed per CRM-9781
497 * Try again without a custom separater to check that one isn't added
498 * (get & check won't accept an array)
500 function testUpdateCreateParticipantFeeLevelNoSeparator() {
502 $myParams = $this->_params +
array('participant_fee_level' => "fee");
503 $participant = civicrm_api('participant', 'create', $myParams);
504 $this->assertAPISuccess($participant);
507 'id' => $participant['id'],
510 civicrm_api('participant', 'create', $update);
511 $this->assertEquals($participant['values'][$participant['id']]['fee_level'],
512 $myParams['participant_fee_level']
514 $this->getAndCheck($update, $participant['id'], 'participant');
516 ///////////////// civicrm_participant_update methods
519 * Test civicrm_participant_update with wrong params type
521 function testUpdateWrongParamsType() {
522 $params = 'a string';
523 $result = civicrm_api('participant', 'create', $params);
524 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
525 $this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__
);
529 * check with empty array
531 function testUpdateEmptyParams() {
532 $params = array('version' => $this->_apiversion
);
533 $participant = civicrm_api('participant', 'create', $params);
534 $this->assertEquals($participant['is_error'], 1);
535 $this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id, contact_id');
539 * check without event_id
541 function testUpdateWithoutEventId() {
542 $participantId = $this->participantCreate(array('contactID' => $this->_individualId
, 'eventID' => $this->_eventID
, 'version' => $this->_apiversion
));
544 'contact_id' => $this->_individualId
,
547 'register_date' => '2006-01-21',
548 'source' => 'US Open',
549 'event_level' => 'Donation',
550 'version' => $this->_apiversion
,
552 $participant = civicrm_api('participant', 'create', $params);
553 $this->assertEquals($participant['is_error'], 1);
554 $this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id');
555 // Cleanup created participant records.
556 $result = $this->participantDelete($participantId);
560 * check with Invalid participantId
562 function testUpdateWithWrongParticipantId() {
567 'register_date' => '2006-01-21',
568 'source' => 'US Open',
569 'event_level' => 'Donation',
570 'version' => $this->_apiversion
,
572 $participant = civicrm_api('Participant', 'update', $params);
573 $this->assertEquals($participant['is_error'], 1);
577 * check with Invalid ContactId
579 function testUpdateWithWrongContactId() {
580 $participantId = $this->participantCreate(array(
581 'contactID' => $this->_individualId
,
582 'eventID' => $this->_eventID
,
583 ), $this->_apiversion
);
585 'id' => $participantId,
586 'contact_id' => 12345,
589 'register_date' => '2006-01-21',
590 'source' => 'US Open',
591 'event_level' => 'Donation',
592 'version' => $this->_apiversion
,
594 $participant = civicrm_api('participant', 'create', $params);
595 $this->assertEquals($participant['is_error'], 1);
596 $result = $this->participantDelete($participantId);
600 * check with complete array
602 function testUpdate() {
603 $participantId = $this->participantCreate(array('contactID' => $this->_individualId
, 'eventID' => $this->_eventID
, $this->_apiversion
));
605 'id' => $participantId,
606 'contact_id' => $this->_individualId
,
607 'event_id' => $this->_eventID
,
610 'register_date' => '2006-01-21',
611 'source' => 'US Open',
612 'event_level' => 'Donation',
613 'version' => $this->_apiversion
,
615 $participant = civicrm_api('participant', 'create', $params);
616 $this->assertNotEquals($participant['is_error'], 1);
619 if (!$participant['is_error']) {
620 $params['id'] = CRM_Utils_Array
::value('id', $participant);
622 // Create $match array with DAO Field Names and expected values
624 'id' => CRM_Utils_Array
::value('id', $participant),
626 // assertDBState compares expected values in $match to actual values in the DB
627 $this->assertDBState('CRM_Event_DAO_Participant', $participant['id'], $match);
629 // Cleanup created participant records.
630 $result = $this->participantDelete($params['id']);
635 ///////////////// civicrm_participant_delete methods
638 * Test civicrm_participant_delete with wrong params type
640 function testDeleteWrongParamsType() {
641 $params = 'a string';
642 $result = civicrm_api('participant', 'delete', $params);
644 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
648 * Test civicrm_participant_delete with empty params
650 function testDeleteEmptyParams() {
652 $result = civicrm_api('participant', 'delete', $params);
654 $this->assertEquals(1, $result['is_error'], 'In line ' . __LINE__
);
658 * check with participant_id
660 function testParticipantDelete() {
662 'id' => $this->_participantID
,
663 'version' => $this->_apiversion
,
665 $participant = civicrm_api('participant', 'delete', $params);
666 $this->assertAPISuccess($participant);
667 $this->assertDBState('CRM_Event_DAO_Participant', $this->_participantID
, NULL, TRUE);
671 * check without participant_id
673 * This should return an error because required param is missing..
675 function testParticipantDeleteMissingID() {
677 'event_id' => $this->_eventID
,
678 'version' => $this->_apiversion
,
680 $participant = civicrm_api('participant', 'delete', $params);
681 $this->assertEquals($participant['is_error'], 1);
682 $this->assertNotNull($participant['error_message']);
685 * delete with a get - a 'criteria delete'
687 function testNestedDelete() {
688 $description = "Criteria delete by nesting a GET & a DELETE";
689 $subfile = "NestedDelete";
690 $participants = civicrm_api('Participant', 'Get', array('version' => 3));
691 $this->assertEquals($participants['count'], 3);
692 $params = array('version' => 3, 'contact_id' => $this->_contactID2
, 'api.participant.delete' => 1);
693 $participants = civicrm_api('Participant', 'Get', $params);
694 $this->documentMe($params, $participants, __FUNCTION__
, __FILE__
, $description, $subfile, 'Get');
695 $participants = civicrm_api('Participant', 'Get', array('version' => 3));
696 $this->assertEquals(1, $participants['count'], "only one participant should be left. line " . __LINE__
);
699 * Test creation of a participant with an associated contribution
701 function testCreateParticipantWithPayment() {
702 $this->_contributionTypeId
= $this->contributionTypeCreate();
703 $description = "single function to create contact w partipation & contribution. Note that in the
704 case of 'contribution' the 'create' is implied (api.contribution.create)";
705 $subfile = "CreateParticipantPayment";
707 'contact_type' => 'Individual',
708 'display_name' => 'dlobo',
709 'version' => $this->_apiversion
,
710 'api.participant' => array(
711 'event_id' => $this->_eventID
,
714 'format.only_id' => 1,
716 'api.contribution.create' => array(
717 'financial_type_id' => 1,
718 'total_amount' => 100,
719 'format.only_id' => 1,
721 'api.participant_payment.create' => array(
722 'contribution_id' => '$value.api.contribution.create',
723 'participant_id' => '$value.api.participant',
727 $result = civicrm_api('contact', 'create', $params);
728 $this->documentMe($params, $result, __FUNCTION__
, __FILE__
, $description, $subfile);
729 $this->assertEquals(1, $result['values'][$result['id']]['api.participant_payment.create']['count']);
730 civicrm_api('contact', 'delete', array('id' => $result['id'], 'version' => $this->_apiversion
));
733 function testParticipantFormattedwithDuplicateParams() {
734 $participantContact = $this->individualCreate(NULL);
736 'contact_id' => $participantContact,
737 'event_id' => $this->_eventID
,
740 require_once 'CRM/Event/Import/Parser.php';
741 $onDuplicate = CRM_Event_Import_Parser
::DUPLICATE_NOCHECK
;
742 $participant = _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate);
743 $this->assertEquals($participant['is_error'], 0);
747 * Test civicrm_participant_formatted with wrong $onDuplicate
749 function testParticipantFormattedwithWrongDuplicateConstant() {
750 $participantContact = $this->individualCreate(NULL);
752 'contact_id' => $participantContact,
753 'event_id' => $this->_eventID
,
757 $participant = _civicrm_api3_deprecated_create_participant_formatted($params, $onDuplicate);
758 $this->assertEquals($participant['is_error'], 0);
761 function testParticipantcheckWithParams() {
762 $participantContact = $this->individualCreate(NULL);
764 'contact_id' => $participantContact,
765 'event_id' => $this->_eventID
,
767 require_once 'CRM/Event/Import/Parser.php';
768 $participant = _civicrm_api3_deprecated_participant_check_params($params);
769 $this->assertEquals($participant, TRUE, 'Check the returned True');
773 * check get with role id - create 2 registrations with different roles.
774 * Test that get without role var returns 2 & with returns one
775 TEST COMMENteD OUT AS HAVE GIVIEN UP ON using filters on get
776 function testGetParamsRole()
778 require_once 'CRM/Event/PseudoConstant.php';
779 CRM_Event_PseudoConstant::flush('participantRole');
780 $participantRole2 = civicrm_api('Participant', 'Create', array('version' => 3, 'id' => $this->_participantID2, 'participant_role_id' => 2));
784 'version' => $this->_apiversion,
787 $result = civicrm_api('participant','get', $params);
788 $this->assertAPISuccess($result);
789 $this->assertEquals($result['count'], 3);
791 $params['participant_role_id'] =2;
792 $result = civicrm_api('participant','get', $params);
794 $this->assertAPISuccess($result, "in line " . __LINE__);
795 $this->assertEquals(2,$result['count'], "in line " . __LINE__);
796 $this->documentMe($params,$result ,__FUNCTION__,__FILE__);