/**
* Test class for Batch API - civicrm_participant_*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
require_once 'CRM/Utils/DeprecatedUtils.php';
require_once 'CiviTest/CiviUnitTestCase.php';
public function setUp() {
$this->_apiversion = 3;
parent::setUp();
- $this->_entity = 'participant';
- $event = $this->eventCreate(NULL);
+ $this->_entity = 'participant';
+ $event = $this->eventCreate(NULL);
$this->_eventID = $event['id'];
$this->_contactID = $this->individualCreate();
$this->_createdParticipants = array();
$this->_individualId = $this->individualCreate();
- $this->_participantID = $this->participantCreate(array('contact_id' => $this->_contactID, 'event_id' => $this->_eventID));
+ $this->_participantID = $this->participantCreate(array(
+ 'contact_id' => $this->_contactID,
+ 'event_id' => $this->_eventID
+ ));
$this->_contactID2 = $this->individualCreate();
- $this->_participantID2 = $this->participantCreate(array('contact_id' => $this->_contactID2, 'event_id' => $this->_eventID));
- $this->_participantID3 = $this->participantCreate(array('contact_id' => $this->_contactID2, 'event_id' => $this->_eventID));
+ $this->_participantID2 = $this->participantCreate(array(
+ 'contact_id' => $this->_contactID2,
+ 'event_id' => $this->_eventID
+ ));
+ $this->_participantID3 = $this->participantCreate(array(
+ 'contact_id' => $this->_contactID2,
+ 'event_id' => $this->_eventID
+ ));
$this->_params = array(
'contact_id' => $this->_contactID,
'event_id' => $this->_eventID,
public function tearDown() {
$this->eventDelete($this->_eventID);
$tablesToTruncate = array(
- 'civicrm_custom_group', 'civicrm_custom_field', 'civicrm_contact', 'civicrm_participant'
+ 'civicrm_custom_group',
+ 'civicrm_custom_field',
+ 'civicrm_contact',
+ 'civicrm_participant',
);
// true tells quickCleanup to drop any tables that might have been created in the test
$this->quickCleanup($tablesToTruncate, TRUE);
'event_id',
'participant_register_date',
'participant_source',
- )
+ ),
);
$result = $this->callAPISuccess('participant', 'get', $params);
$this->assertAPISuccess($result, " in line " . __LINE__);
public function testGetNestedEventGet() {
//create a second event & add participant to it.
$event = $this->eventCreate(NULL);
- $this->callAPISuccess('participant', 'create', array('event_id' => $event['id'], 'contact_id' => $this->_contactID));
+ $this->callAPISuccess('participant', 'create', array(
+ 'event_id' => $event['id'],
+ 'contact_id' => $this->_contactID
+ ));
$description = "use nested get to get an event";
- $subfile = "NestedEventGet";
- $params = array(
+ $subfile = "NestedEventGet";
+ $params = array(
'id' => $this->_participantID,
'api.event.get' => 1,
);
public function testGetWithReturnProperties() {
$params = array(
'contact_id' => $this->_contactID,
- 'return.status_id' => 1,
+ 'return.status_id' => 1,
'return.participant_status_id' => 1,
- 'options' => array('limit' => 1)
+ 'options' => array('limit' => 1),
);
$result = $this->callAPISuccess('participant', 'get', $params);
$this->assertArrayHasKey('participant_status_id', $result['values'][$result['id']]);
*/
public function testGetContactIdOnly() {
$params = array(
- 'contact_id' => $this->_contactID,);
+ 'contact_id' => $this->_contactID,
+ );
$participant = $this->callAPISuccess('participant', 'get', $params);
$this->assertEquals($this->_participantID, $participant['id'],
public function testGetMultiMatchReturnFirst() {
$params = array(
'event_id' => $this->_eventID,
- 'rowCount' => 1,);
+ 'rowCount' => 1,
+ );
$participant = $this->callAPISuccess('participant', 'get', $params);
$this->assertNotNull($participant['id']);
public function testCreateUpdateReceiveDate() {
$participant = $this->callAPISuccess('participant', 'create', $this->_params);
$update = array(
- 'id' => $participant['id'],
+ 'id' => $participant['id'],
'status_id' => 2,
);
$this->callAPISuccess('participant', 'create', $update);
public function testUpdate() {
$participantId = $this->participantCreate(array(
'contactID' => $this->_individualId,
- 'eventID' => $this->_eventID
+ 'eventID' => $this->_eventID,
));
$params = array(
'id' => $participantId,
$participant = $this->callAPISuccess('participant', 'create', $myParams);
$this->assertAPISuccess($participant);
$update = array(
- 'id' => $participant['id'],
+ 'id' => $participant['id'],
'status_id' => 2,
);
$this->callAPISuccess('participant', 'create', $update);
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation',);
+ 'event_level' => 'Donation',
+ );
$participant = $this->callAPIFailure('participant', 'create', $params);
$this->assertEquals($participant['error_message'], 'Mandatory key(s) missing from params array: event_id');
// Cleanup created participant records.
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation',);
+ 'event_level' => 'Donation',
+ );
$participant = $this->callAPIFailure('Participant', 'update', $params);
}
public function testUpdateWithWrongContactId() {
$participantId = $this->participantCreate(array(
'contactID' => $this->_individualId,
- 'eventID' => $this->_eventID,
- ), $this->_apiversion);
+ 'eventID' => $this->_eventID,
+ ), $this->_apiversion);
$params = array(
'id' => $participantId,
'contact_id' => 12345,
'role_id' => 3,
'register_date' => '2006-01-21',
'source' => 'US Open',
- 'event_level' => 'Donation',);
+ 'event_level' => 'Donation',
+ );
$participant = $this->callAPIFailure('participant', 'create', $params);
$result = $this->participantDelete($participantId);
}
*/
public function testParticipantDelete() {
$params = array(
- 'id' => $this->_participantID,);
+ 'id' => $this->_participantID,
+ );
$participant = $this->callAPISuccess('participant', 'delete', $params);
$this->assertAPISuccess($participant);
$this->assertDBState('CRM_Event_DAO_Participant', $this->_participantID, NULL, TRUE);
*/
public function testParticipantDeleteMissingID() {
$params = array(
- 'event_id' => $this->_eventID,);
+ 'event_id' => $this->_eventID,
+ );
$participant = $this->callAPIFailure('participant', 'delete', $params);
$this->assertNotNull($participant['error_message']);
}
* Delete with a get - a 'criteria delete'
*/
public function testNestedDelete() {
- $description = "Criteria delete by nesting a GET & a DELETE";
- $subfile = "NestedDelete";
+ $description = "Criteria delete by nesting a GET & a DELETE";
+ $subfile = "NestedDelete";
$participants = $this->callAPISuccess('Participant', 'Get', array());
$this->assertEquals($participants['count'], 3);
$params = array('contact_id' => $this->_contactID2, 'api.participant.delete' => 1);