+--------------------------------------------------------------------+
| CiviCRM version 4.6 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
require_once 'CiviTest/CiviUnitTestCase.php';
///////////////// civicrm_participant_get methods
/**
- * Check with wrong params type
+ * Check with wrong params type.
*/
public function testGetWrongParamsType() {
$params = 'a string';
}
/**
- * Test civicrm_participant_get with empty params
+ * Test civicrm_participant_get with empty params.
*/
public function testGetEmptyParams() {
$this->callAPISuccess('participant', 'get', array());
}
/**
- * Check with participant_id
+ * Check with participant_id.
*/
public function testGetParticipantIdOnly() {
$params = array(
}
/**
- * Check with params id
+ * Check with params id.
*/
public function testGetParamsAsIdOnly() {
$params = array(
}
/**
- * Check with params id
+ * Check with params id.
*/
public function testGetNestedEventGet() {
//create a second event & add participant to it.
'contact_id' => $this->_contactID,
));
- $description = "use nested get to get an event";
+ $description = "Demonstrates use of nested get to fetch event data with participant records.";
$subfile = "NestedEventGet";
$params = array(
'id' => $this->_participantID,
}
/**
- * Check Participant Get respects return properties
+ * Check Participant Get respects return properties.
*/
public function testGetWithReturnProperties() {
$params = array(
}
/**
- * Check with contact_id
+ * Check with contact_id.
*/
public function testGetContactIdOnly() {
$params = array(
}
/**
- * Check with event_id
+ * Check with event_id.
* fetch first record
*/
public function testGetMultiMatchReturnFirst() {
}
/**
- * Check with event_id
+ * Check with event_id.
* in v3 this should return all participants
*/
public function testGetMultiMatchNoReturnFirst() {
///////////////// civicrm_participant_get methods
/**
- * Test civicrm_participant_get with empty params
+ * Test civicrm_participant_get with empty params.
* In this case all the participant records are returned.
*/
public function testSearchEmptyParams() {
}
/**
- * Check with participant_id
+ * Check with participant_id.
*/
public function testSearchParticipantIdOnly() {
$params = array(
}
/**
- * Check with contact_id
+ * Check with contact_id.
*/
public function testSearchContactIdOnly() {
// Should get 2 participant records for this contact.
}
/**
- * Check with event_id
+ * Check with event_id.
*/
public function testSearchByEvent() {
// Should get >= 3 participant records for this event. Also testing that last_name and event_title are returned.
}
/**
- * Check with event_id
+ * Check with event_id.
* fetch with limit
*/
public function testSearchByEventWithLimit() {
);
$participant = $this->callAPISuccess('participant', 'get', $params);
- $this->assertEquals($participant['count'], 2, 'in line ' . __LINE__);
+ $this->assertEquals($participant['count'], 2);
}
///////////////// civicrm_participant_create methods
/**
- * Test civicrm_participant_create with empty params
+ * Test civicrm_participant_create with empty params.
*/
public function testCreateEmptyParams() {
$params = array();
}
/**
- * Check with event_id
+ * Check with event_id.
*/
public function testCreateMissingContactID() {
$params = array(
}
/**
- * Check with contact_id
+ * Check with contact_id.
* without event_id
*/
public function testCreateMissingEventID() {
}
/**
- * Check with complete array
+ * Check with complete array.
*/
public function testCreateAllParams() {
$params = $this->_params;
$this->callAPISuccess('PriceFieldValue', 'delete', array('id' => $pfv2['id']));
$this->callAPISuccess('PriceField', 'delete', array('id' => $pricefield['id']));
$this->callAPISuccess('PriceSet', 'delete', array('id' => $priceset['id']));
- */
+ */
}
/**
- * Check with complete array
+ * Check with complete array.
*/
public function testUpdate() {
$participantId = $this->participantCreate(array(
///////////////// civicrm_participant_update methods
/**
- * Test civicrm_participant_update with wrong params type
+ * Test civicrm_participant_update with wrong params type.
*/
public function testUpdateWrongParamsType() {
$params = 'a string';
$result = $this->callAPIFailure('participant', 'create', $params);
- $this->assertEquals('Input variable `params` is not an array', $result['error_message'], 'In line ' . __LINE__);
+ $this->assertEquals('Input variable `params` is not an array', $result['error_message']);
}
/**
- * Check with empty array
+ * Check with empty array.
*/
public function testUpdateEmptyParams() {
$params = array();
}
/**
- * Check without event_id
+ * Check without event_id.
*/
public function testUpdateWithoutEventId() {
$participantId = $this->participantCreate(array('contactID' => $this->_individualId, 'eventID' => $this->_eventID));
}
/**
- * Check with Invalid participantId
+ * Check with Invalid participantId.
*/
public function testUpdateWithWrongParticipantId() {
$params = array(
}
/**
- * Check with Invalid ContactId
+ * Check with Invalid ContactId.
*/
public function testUpdateWithWrongContactId() {
$participantId = $this->participantCreate(array(
///////////////// civicrm_participant_delete methods
/**
- * Test civicrm_participant_delete with wrong params type
+ * Test civicrm_participant_delete with wrong params type.
*/
public function testDeleteWrongParamsType() {
$params = 'a string';
}
/**
- * Test civicrm_participant_delete with empty params
+ * Test civicrm_participant_delete with empty params.
*/
public function testDeleteEmptyParams() {
$params = array();
}
/**
- * Check with participant_id
+ * Check with participant_id.
*/
public function testParticipantDelete() {
$params = array(
}
/**
- * Check without participant_id
+ * Check without participant_id.
* and with event_id
* This should return an error because required param is missing..
*/
* Delete with a get - a 'criteria delete'
*/
public function testNestedDelete() {
- $description = "Criteria delete by nesting a GET & a DELETE";
+ $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);
- $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile, 'Get');
+ $participants = $this->callAPIAndDocument('Participant', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
$check = $this->callAPISuccess('participant', 'getcount', array());
$this->assertEquals(1, $check, "only one participant should be left. line " . __LINE__);
}
/**
- * Test creation of a participant with an associated contribution
+ * Test creation of a participant with an associated contribution.
*/
public function testCreateParticipantWithPayment() {
- $description = "single function to create contact w partipation & contribution. Note that in the
- case of 'contribution' the 'create' is implied (api.contribution.create)";
+ $description = "Single function to create contact with partipation & contribution.
+ Note that in the case of 'contribution' the 'create' is implied (api.contribution.create)";
$subfile = "CreateParticipantPayment";
$params = array(
'contact_type' => 'Individual',