CRM-19715, fixed api test so that its not affected by any deletion of activity types...
authorPradeep Nayak <pradpnayak@gmail.com>
Wed, 29 Mar 2017 14:53:02 +0000 (20:23 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Wed, 29 Mar 2017 14:53:02 +0000 (20:23 +0530)
----------------------------------------
* CRM-19715: Remove Close Accounting Period code
  https://issues.civicrm.org/jira/browse/CRM-19715

api/v3/examples/Activity/ContactRefCustomField.php
api/v3/examples/Activity/ContactRefCustomFieldGet.php
api/v3/examples/Activity/Create.php
api/v3/examples/Activity/DateTimeHigh.php
api/v3/examples/Activity/DateTimeLow.php
api/v3/examples/Activity/Get.php
api/v3/examples/Activity/ReturnAssigneeContact.php
tests/phpunit/api/v3/ActivityTest.php

index b830541308b82072a34e0c925ac11be684ccff42..b7e650b6e3ebdd1f7f2f4daf0ee133ea719509a5 100644 (file)
@@ -10,7 +10,7 @@
 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,
@@ -57,7 +57,7 @@ function activity_create_expectedresult() {
       '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',
index 8603caf946b6fc24ebc48fdbaa3c5fc1702b4a6e..47e797e5b546dab3b0413578b625ea038ef4ec59 100644 (file)
@@ -48,7 +48,7 @@ function activity_get_expectedresult() {
     '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',
index a380f128d0bea2bd72619be3540c56ad83fd22a6..0a3c1474f34fa6b31cb8f1ca88f96af6faf705ef 100644 (file)
@@ -8,7 +8,7 @@
 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,
@@ -55,7 +55,7 @@ function activity_create_expectedresult() {
       '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',
index 54d9ace23213e44e993e6745fe368c3d39c8cd89..b41659c20515cfc48ecb483e42723b126b9e4d1d 100644 (file)
@@ -49,7 +49,7 @@ function activity_get_expectedresult() {
     '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',
index e670e377e2f7884d2c6deb0ae7ec9d3e3e8e2235..dec83787debbb812079e84916cc67c80659d8e2c 100644 (file)
@@ -48,7 +48,7 @@ function activity_get_expectedresult() {
     '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',
index 1d981955898e80add961209b2d70ae4ae3e40846..9a208f9df17f11c073920312d0c7ae2c89530c8c 100644 (file)
@@ -8,7 +8,7 @@
 function activity_get_example() {
   $params = array(
     'contact_id' => 1,
-    'activity_type_id' => '55',
+    'activity_type_id' => 9999,
     'sequential' => 1,
     'return.custom_1' => 1,
   );
@@ -47,17 +47,24 @@ function activity_get_expectedresult() {
     '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',
       ),
     ),
index 4042c39fff4ae8946b4ced77286657829cdf52ae..6c3464a113cb9ce9801135a7f2a6d1e2799df43d 100644 (file)
@@ -52,7 +52,7 @@ function activity_get_expectedresult() {
     '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',
@@ -134,6 +134,7 @@ function activity_get_expectedresult() {
               'im' => '',
               'worldregion_id' => '',
               'world_region' => '',
+              'languages' => 'English (United States)',
               'individual_prefix' => 'Mr.',
               'individual_suffix' => 'II',
               'communication_style' => '',
index 5ce55f7c0f4bb9e4e55e8d900f0f535eb8bcf36b..414a6643d9b1767da48af1a6c72fa44c1498aaac 100644 (file)
@@ -60,17 +60,18 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
 
     $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,
@@ -401,16 +402,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
     $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.
    */
@@ -429,6 +420,16 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
     $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.
    */
@@ -1170,7 +1171,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
     $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]);
     }