CRM-13072 more test class upgrades
[civicrm-core.git] / api / v3 / examples / PhoneGet.php
index b8f6c15b0b30c66c238ec555626209726616a0a9..a590a57046071e712bc8ed32d594fddc02a2d3ed 100644 (file)
@@ -1,21 +1,29 @@
 <?php
-
-/*
+/**
+ * Test Generated example of using phone get API
+ * *
  */
 function phone_get_example(){
 $params = array(
-  'contact_id' => 8,
+  'contact_id' => 7,
   'phone' => '(123) 456-7890',
-  'version' => 3,
 );
 
-  $result = civicrm_api( 'phone','get',$params );
+try{
+  $result = civicrm_api3('phone', 'get', $params);
+}
+catch (CiviCRM_API3_Exception $e) {
+  // handle error here
+  $errorMessage = $e->getMessage();
+  $errorCode = $e->getErrorCode();
+  $errorData = $e->getExtraParams();
+  return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
+}
 
-  return $result;
+return $result;
 }
 
-/*
+/**
  * Function returns array of result expected from previous function
  */
 function phone_get_expectedresult(){
@@ -28,8 +36,8 @@ function phone_get_expectedresult(){
   'values' => array(
       '1' => array(
           'id' => '1',
-          'contact_id' => '8',
-          'location_type_id' => '11',
+          'contact_id' => '7',
+          'location_type_id' => '10',
           'is_primary' => '1',
           'is_billing' => 0,
           'phone' => '(123) 456-7890',
@@ -39,7 +47,7 @@ function phone_get_expectedresult(){
     ),
 );
 
-  return $expectedResult  ;
+  return $expectedResult;
 }