Short array syntax - auto-convert api dir
[civicrm-core.git] / api / v3 / examples / PledgePayment / Create.php
index 41136a1873c4ed63ebbe1dbf3db04979f80be00f..07070f6a61e7f7626f29d4695fec4910fb80a408 100644 (file)
@@ -1,33 +1,33 @@
 <?php
 /**
- * Test Generated example of using pledge_payment create API.
- *
+ * Test Generated example demonstrating the PledgePayment.create API.
  *
  * @return array
  *   API result array
  */
 function pledge_payment_create_example() {
-  $params = array(
+  $params = [
     'contact_id' => 1,
     'pledge_id' => 1,
     'contribution_id' => 1,
     'status_id' => 1,
     'actual_amount' => 20,
-  );
+  ];
 
   try{
-    $result = civicrm_api3('pledge_payment', 'create', $params);
+    $result = civicrm_api3('PledgePayment', 'create', $params);
   }
   catch (CiviCRM_API3_Exception $e) {
     // Handle error here.
     $errorMessage = $e->getMessage();
     $errorCode = $e->getErrorCode();
     $errorData = $e->getExtraParams();
-    return array(
-      'error' => $errorMessage,
+    return [
+      'is_error' => 1,
+      'error_message' => $errorMessage,
       'error_code' => $errorCode,
       'error_data' => $errorData,
-    );
+    ];
   }
 
   return $result;
@@ -41,13 +41,13 @@ function pledge_payment_create_example() {
  */
 function pledge_payment_create_expectedresult() {
 
-  $expectedResult = array(
+  $expectedResult = [
     'is_error' => 0,
     'version' => 3,
     'count' => 1,
     'id' => 1,
-    'values' => array(
-      '1' => array(
+    'values' => [
+      '1' => [
         'id' => '1',
         'pledge_id' => '1',
         'contribution_id' => '1',
@@ -58,18 +58,17 @@ function pledge_payment_create_expectedresult() {
         'reminder_date' => '',
         'reminder_count' => '',
         'status_id' => '1',
-      ),
-    ),
-  );
+      ],
+    ],
+  ];
 
   return $expectedResult;
 }
 
-/**
+/*
 * This example has been generated from the API test suite.
-* The test that created it is called
-* testCreatePledgePayment
-* and can be found in
+* The test that created it is called "testCreatePledgePayment"
+* and can be found at:
 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php
 *
 * You can see the outcome of the API tests at
@@ -79,7 +78,7 @@ function pledge_payment_create_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