<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Test APIv3 civicrm_activity_contact* functions
*
- * @package CiviCRM_APIv3
- * @subpackage API_Activity
+ * @package CiviCRM_APIv3
+ * @subpackage API_Activity
*/
class api_v3_ActivityContactTest extends CiviUnitTestCase {
protected $_apiversion;
protected $_params;
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
+ $this->useTransaction(TRUE);
- $this->_contactID = $this->organizationCreate();
- $activity = $this->activityCreate();
- $this->_activityID = $activity['id'];
+ $this->_contactID = $this->organizationCreate();
+ $activity = $this->activityCreate();
+ $this->_activityID = $activity['id'];
CRM_Core_PseudoConstant::flush();
- $this->quickCleanup(array('civicrm_activity_contact'));
$this->_params = array(
'contact_id' => $this->_contactID,
'activity_id' => $this->_activityID,
);
}
- function tearDown() {
- $params['activity_id'] = $this->_activityID;
- $this->callAPISuccess('activity', 'delete', $params);
- $this->contactDelete($this->_contactID);
- }
-
public function testCreateActivityContact() {
$result = $this->callAPIAndDocument('activity_contact', 'create', $this->_params, __FUNCTION__, __FILE__);
//create one
$create = $this->callAPISuccess('activity_contact', 'create', $this->_params);
- $result = $this->callAPIAndDocument('activity_contact', 'delete', array('id' => $create['id'],), __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('activity_contact', 'delete', array('id' => $create['id']), __FUNCTION__, __FILE__);
$this->assertEquals(1, $result['count']);
$get = $this->callAPISuccess('activity_contact', 'get', array(
'id' => $create['id'],
$this->assertEquals(0, $get['count'], 'ActivityContact not successfully deleted');
}
+ /**
+ *
+ */
public function testGetActivitiesByContact() {
- $result = $this->callAPISuccess('ActivityContact', 'Get', array('contact_id' => $this->_contactID));
+ $this->callAPISuccess('ActivityContact', 'Get', array('contact_id' => $this->_contactID));
}
- public function testGetPartitipantsByActivity() {
- $result = $this->callAPISuccess('ActivityContact', 'Get', array('activity_id' => $this->_activityID));
+ public function testGetParticipantsByActivity() {
+ $this->callAPISuccess('ActivityContact', 'Get', array('activity_id' => $this->_activityID));
}
/**
$this->callAPIFailure('ActivityContact', 'Get', array('record_type_id' => 'abc'));
}
}
-