Merge remote-tracking branch 'origin/4.5' into 4.5-master-2015-02-24-17-24-05
[civicrm-core.git] / api / v3 / examples / Contact / GetFieldsOptions.php
index 7425c141fec1418c84d36228d5441ff901803b0f..d45717fe3711f9fbcfb90576138a6b77c2df4229 100644 (file)
@@ -1,14 +1,8 @@
 <?php
 /**
- * @file
- * Test Generated API Example.
- * See bottom of this file for more detail.
- */
-
-/**
- * Test Generated example of using contact GetFields API.
+ * Test Generated example demonstrating the Contact.getfields API.
  *
- * Demonstrate retrieving metadata with custom field options
+ * Demonstrates retrieving metadata with custom field options.
  *
  * @return array
  *   API result array
@@ -22,7 +16,7 @@ function contact_getfields_example() {
   );
 
   try{
-    $result = civicrm_api3('contact', 'GetFields', $params);
+    $result = civicrm_api3('Contact', 'getfields', $params);
   }
   catch (CiviCRM_API3_Exception $e) {
     // Handle error here.
@@ -200,7 +194,7 @@ function contact_getfields_expectedresult() {
         'name' => 'external_identifier',
         'type' => 2,
         'title' => 'External Identifier',
-        'maxlength' => 32,
+        'maxlength' => 64,
         'size' => 8,
         'import' => TRUE,
         'where' => 'civicrm_contact.external_identifier',
@@ -747,7 +741,7 @@ function contact_getfields_expectedresult() {
         'extends_entity_column_id' => '',
         'is_view' => 0,
         'is_multiple' => 0,
-        'option_group_id' => '105',
+        'option_group_id' => '106',
         'date_format' => '',
         'time_format' => '',
         'is_required' => '1',
@@ -763,10 +757,12 @@ function contact_getfields_expectedresult() {
         'title' => 'Current Employer',
         'description' => 'Name of Current Employer',
         'type' => 2,
+        'name' => 'current_employer',
       ),
       'dupe_check' => array(
         'title' => 'Check for Duplicates',
         'description' => 'Throw error if contact create matches dedupe rule',
+        'name' => 'dupe_check',
       ),
     ),
   );
@@ -774,11 +770,10 @@ function contact_getfields_expectedresult() {
   return $expectedResult;
 }
 
-/**
+/*
 * This example has been generated from the API test suite.
-* The test that created it is called
-* testCustomFieldCreateWithOptionValues
-* and can be found in
+* The test that created it is called "testCustomFieldCreateWithOptionValues"
+* 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
@@ -788,7 +783,7 @@ function contact_getfields_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