Merge pull request #9410 from jmcclelland/CRM-19664
[civicrm-core.git] / api / v3 / examples / Contact / ChainTwoWebsitesSyntax2.php
index f9d8ba0bd3629933dc4622be7bb48e103782ba61..f6ae673091d10b66f7f37279f5e413a9a520129b 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Test Generated example of using contact create API.
+ * Test Generated example demonstrating the Contact.create API.
  *
  * Demonstrates creating two websites as an array.
  *
@@ -38,7 +38,7 @@ function contact_create_example() {
   );
 
   try{
-    $result = civicrm_api3('contact', 'create', $params);
+    $result = civicrm_api3('Contact', 'create', $params);
   }
   catch (CiviCRM_API3_Exception $e) {
     // Handle error here.
@@ -46,7 +46,8 @@ function contact_create_example() {
     $errorCode = $e->getErrorCode();
     $errorData = $e->getExtraParams();
     return array(
-      'error' => $errorMessage,
+      'is_error' => 1,
+      'error_message' => $errorMessage,
       'error_code' => $errorCode,
       'error_data' => $errorData,
     );
@@ -67,10 +68,10 @@ function contact_create_expectedresult() {
     'is_error' => 0,
     'version' => 3,
     'count' => 1,
-    'id' => 1,
+    'id' => 3,
     'values' => array(
-      '1' => array(
-        'id' => '1',
+      '3' => array(
+        'id' => '3',
         'contact_type' => 'Individual',
         'contact_sub_type' => '',
         'do_not_email' => 0,
@@ -127,7 +128,7 @@ function contact_create_expectedresult() {
           'values' => array(
             '0' => array(
               'id' => '1',
-              'contact_id' => '1',
+              'contact_id' => '3',
               'financial_type_id' => '1',
               'contribution_page_id' => '',
               'payment_instrument_id' => '1',
@@ -154,6 +155,7 @@ function contact_create_expectedresult() {
               'campaign_id' => '',
               'creditnote_id' => '',
               'tax_amount' => '',
+              'revenue_recognition_date' => '',
               'contribution_type_id' => '1',
             ),
           ),
@@ -167,7 +169,7 @@ function contact_create_expectedresult() {
             'values' => array(
               '0' => array(
                 'id' => '1',
-                'contact_id' => '1',
+                'contact_id' => '3',
                 'url' => 'http://civicrm.org',
                 'website_type_id' => '',
               ),
@@ -181,7 +183,7 @@ function contact_create_expectedresult() {
             'values' => array(
               '0' => array(
                 'id' => '2',
-                'contact_id' => '1',
+                'contact_id' => '3',
                 'url' => 'http://chained.org',
                 'website_type_id' => '2',
               ),
@@ -195,11 +197,10 @@ function contact_create_expectedresult() {
   return $expectedResult;
 }
 
-/**
+/*
 * This example has been generated from the API test suite.
-* The test that created it is called
-* testCreateIndividualWithContributionChainedArrays
-* and can be found in
+* The test that created it is called "testCreateIndividualWithContributionChainedArrays"
+* 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