Merge pull request #2714 from jitendrapurohit/CRMTestFix
[civicrm-core.git] / api / v3 / examples / System / Flush.php
index e57a8e0c3f2df031e7ed240fbc95cf416d1d7b40..4eb8a620a700aa5057fed9c005e4e5828d31f6d6 100644 (file)
@@ -1,19 +1,26 @@
 <?php
-
-/*
- Flush all system caches
+/**
+ * Test Generated example of using system flush API
+ * Flush all system caches *
  */
 function system_flush_example(){
-$params = array(
-  'version' => 3,
-);
+$params = array();
 
-  $result = civicrm_api( 'system','flush',$params );
+try{
+  $result = civicrm_api3('system', 'flush', $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 system_flush_expectedresult(){
@@ -25,7 +32,7 @@ function system_flush_expectedresult(){
   'values' => 1,
 );
 
-  return $expectedResult  ;
+  return $expectedResult;
 }
 
 
@@ -33,20 +40,20 @@ function system_flush_expectedresult(){
 * This example has been generated from the API test suite. The test that created it is called
 *
 * testFlush and can be found in
-* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/SystemTest.php
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SystemTest.php
 *
 * You can see the outcome of the API tests at
-* http://tests.dev.civicrm.org/trunk/results-api_v3
+* https://test.civicrm.org/job/CiviCRM-master-git/
 *
 * To Learn about the API read
-* http://book.civicrm.org/developer/current/techniques/api/
+* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
 *
-* and review the wiki at
-* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
+* Browse the api on your own site with the api explorer
+* http://MYSITE.ORG/path/to/civicrm/api/explorer
 *
 * Read more about testing here
 * http://wiki.civicrm.org/confluence/display/CRM/Testing
 *
 * API Standards documentation:
 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
-*/
\ No newline at end of file
+*/