Merge pull request #9690 from jitendrapurohit/CRM-19887
[civicrm-core.git] / api / v3 / examples / Contact / GetActions.php
index efd03c4a9e911d12ea4b1be70bcc1a03c9aac9c3..d2c85713ed1ceecc4735db3475a133f495667b2a 100644 (file)
@@ -1,12 +1,6 @@
 <?php
 /**
- * @file
- * Test Generated API Example.
- * See bottom of this file for more detail.
- */
-
-/**
- * Test Generated example of using contact getactions API.
+ * Test Generated example demonstrating the Contact.getactions API.
  *
  * Getting the available actions for an entity.
  *
@@ -17,7 +11,7 @@ function contact_getactions_example() {
   $params = array();
 
   try{
-    $result = civicrm_api3('contact', 'getactions', $params);
+    $result = civicrm_api3('Contact', 'getactions', $params);
   }
   catch (CiviCRM_API3_Exception $e) {
     // Handle error here.
@@ -25,7 +19,8 @@ function contact_getactions_example() {
     $errorCode = $e->getErrorCode();
     $errorData = $e->getExtraParams();
     return array(
-      'error' => $errorMessage,
+      'is_error' => 1,
+      'error_message' => $errorMessage,
       'error_code' => $errorCode,
       'error_data' => $errorData,
     );
@@ -45,33 +40,37 @@ function contact_getactions_expectedresult() {
   $expectedResult = array(
     'is_error' => 0,
     'version' => 3,
-    'count' => 22,
+    'count' => 25,
     'values' => array(
       '0' => 'create',
       '1' => 'delete',
-      '2' => 'example_action1',
-      '3' => 'example_action2',
-      '4' => 'get',
-      '5' => 'getactions',
-      '6' => 'getcount',
-      '7' => 'getfields',
-      '8' => 'getlist',
-      '9' => 'getoptions',
-      '10' => 'getquick',
-      '11' => 'getrefcount',
-      '12' => 'getsingle',
-      '13' => 'getvalue',
-      '14' => 'merge',
-      '15' => 'proximity',
-      '16' => 'replace',
-      '17' => 'setvalue',
-      '18' => 'type_create',
-      '19' => 'type_delete',
-      '20' => 'type_get',
-      '21' => 'update',
+      '2' => 'duplicatecheck',
+      '3' => 'example_action1',
+      '4' => 'example_action2',
+      '5' => 'get',
+      '6' => 'getactions',
+      '7' => 'getcount',
+      '8' => 'getfield',
+      '9' => 'getfields',
+      '10' => 'getlist',
+      '11' => 'getoptions',
+      '12' => 'getquick',
+      '13' => 'getrefcount',
+      '14' => 'getsingle',
+      '15' => 'getvalue',
+      '16' => 'merge',
+      '17' => 'proximity',
+      '18' => 'replace',
+      '19' => 'setvalue',
+      '20' => 'type_create',
+      '21' => 'type_delete',
+      '22' => 'type_get',
+      '23' => 'update',
+      '24' => 'validate',
     ),
     'deprecated' => array(
       'getquick' => 'The "getquick" action is deprecated in favor of "getlist".',
+      'setvalue' => 'The "setvalue" action is deprecated. Use "create" with an id instead.',
       'update' => 'The "update" action is deprecated. Use "create" with an id instead.',
     ),
   );
@@ -79,11 +78,10 @@ function contact_getactions_expectedresult() {
   return $expectedResult;
 }
 
-/**
+/*
 * This example has been generated from the API test suite.
-* The test that created it is called
-* testGetActions
-* and can be found in
+* The test that created it is called "testGetActions"
+* and can be found at:
 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php
 *
 * You can see the outcome of the API tests at
@@ -93,7 +91,7 @@ function contact_getactions_expectedresult() {
 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
 *
 * Browse the api on your own site with the api explorer
-* http://MYSITE.ORG/path/to/civicrm/api/explorer
+* http://MYSITE.ORG/path/to/civicrm/api
 *
 * Read more about testing here
 * http://wiki.civicrm.org/confluence/display/CRM/Testing