function activity_create_example() {
$params = array(
'source_contact_id' => 1,
- 'activity_type_id' => '55',
+ 'activity_type_id' => 'Test activity type',
'subject' => 'test activity type id',
'activity_date_time' => '2011-06-02 14:36:13',
'status_id' => 2,
'1' => array(
'id' => '1',
'source_record_id' => '',
- 'activity_type_id' => '55',
+ 'activity_type_id' => '9999',
'subject' => 'test activity type id',
'activity_date_time' => '20110602143613',
'duration' => '120',
'values' => array(
'1' => array(
'id' => '1',
- 'activity_type_id' => '55',
+ 'activity_type_id' => '9999',
'subject' => 'test activity type id',
'activity_date_time' => '2011-06-02 14:36:13',
'duration' => '120',
function activity_create_example() {
$params = array(
'source_contact_id' => 1,
- 'activity_type_id' => '55',
+ 'activity_type_id' => 'Test activity type',
'subject' => 'test activity type id',
'activity_date_time' => '2011-06-02 14:36:13',
'status_id' => 2,
'1' => array(
'id' => '1',
'source_record_id' => '',
- 'activity_type_id' => '55',
+ 'activity_type_id' => '9999',
'subject' => 'test activity type id',
'activity_date_time' => '20110602143613',
'duration' => '120',
'values' => array(
'0' => array(
'id' => '1',
- 'activity_type_id' => '55',
+ 'activity_type_id' => '9999',
'subject' => 'Make-it-Happen Meeting',
'activity_date_time' => '2011-01-01 00:00:00',
'duration' => '120',
'values' => array(
'0' => array(
'id' => '2',
- 'activity_type_id' => '55',
+ 'activity_type_id' => '9999',
'subject' => 'Make-it-Happen Meeting',
'activity_date_time' => '2012-02-16 00:00:00',
'duration' => '120',
function activity_get_example() {
$params = array(
'contact_id' => 1,
- 'activity_type_id' => '55',
+ 'activity_type_id' => 9999,
'sequential' => 1,
'return.custom_1' => 1,
);
'id' => 1,
'values' => array(
'0' => array(
- 'source_contact_id' => '1',
'id' => '1',
- 'activity_type_id' => '55',
+ 'activity_type_id' => '9999',
'subject' => 'test activity type id',
- 'location' => 'Pennsylvania',
'activity_date_time' => '2011-06-02 14:36:13',
+ 'duration' => '120',
+ 'location' => 'Pennsylvania',
'details' => 'a test activity',
'status_id' => '2',
- 'activity_name' => 'Test activity type',
- 'status' => 'Completed',
+ 'priority_id' => '1',
+ 'is_test' => 0,
+ 'is_auto' => 0,
+ 'is_current_revision' => '1',
+ 'is_deleted' => 0,
+ 'is_star' => 0,
'custom_1' => 'custom string',
+ 'source_contact_id' => '1',
+ 'status' => 'Completed',
+ 'activity_name' => 'Test activity type',
'custom_1_1' => 'custom string',
),
),
'values' => array(
'0' => array(
'id' => '1',
- 'activity_type_id' => '55',
+ 'activity_type_id' => '9999',
'subject' => 'test activity type id',
'activity_date_time' => '2011-06-02 14:36:13',
'duration' => '120',
'im' => '',
'worldregion_id' => '',
'world_region' => '',
+ 'languages' => 'English (United States)',
'individual_prefix' => 'Mr.',
'individual_suffix' => 'II',
'communication_style' => '',
$this->_contactID = $this->individualCreate();
//create activity types
+ $this->test_activity_type_value = 9999;
$activityTypes = $this->callAPISuccess('option_value', 'create', array(
'option_group_id' => 2,
'name' => 'Test activity type',
'label' => 'Test activity type',
+ 'value' => $this->test_activity_type_value,
'sequential' => 1,
));
- $this->test_activity_type_value = $activityTypes['values'][0]['value'];
$this->test_activity_type_id = $activityTypes['id'];
$this->_params = array(
'source_contact_id' => $this->_contactID,
- 'activity_type_id' => $this->test_activity_type_value,
+ 'activity_type_id' => 'Test activity type',
'subject' => 'test activity type id',
'activity_date_time' => '2011-06-02 14:36:13',
'status_id' => 2,
$this->assertEquals($assignee['id'], $result['assignee_contact_id'][0]);
}
- /**
- * Test civicrm_activity_create() using example code.
- */
- public function testActivityCreateExample() {
- require_once 'api/v3/examples/Activity/Create.php';
- $result = activity_create_example();
- $expectedResult = activity_create_expectedresult();
- $this->assertEquals($result, $expectedResult);
- }
-
/**
* Test civicrm_activity_create() with valid parameters and custom data.
*/
$this->customGroupDelete($ids['custom_group_id']);
}
+ /**
+ * Test civicrm_activity_create() using example code.
+ */
+ public function testActivityCreateExample() {
+ require_once 'api/v3/examples/Activity/Create.php';
+ $result = activity_create_example();
+ $expectedResult = activity_create_expectedresult();
+ $this->assertEquals($result, $expectedResult);
+ }
+
/**
* Test civicrm_activity_create() with valid parameters and custom data.
*/
$this->assertEquals(1, count($target), ' in line ' . __LINE__);
$this->assertEquals(TRUE, in_array($contact3, $assignee), ' in line ' . __LINE__);
$this->assertEquals(TRUE, in_array($contact4, $target), ' in line ' . __LINE__);
-
+ $this->_params['activity_type_id'] = $this->test_activity_type_value;
foreach ($this->_params as $fld => $val) {
$this->assertEquals($val, $result['values'][$result['id']][$fld]);
}