INFRA-132 - Add space before "{"
[civicrm-core.git] / tests / phpunit / api / v3 / APIStandardsTest.php
index 822658ebd3fd80ce44afbeccd307ebd40944a84b..2bd49113985aabc37084e8b1c676434af3cf21f9 100644 (file)
@@ -6,11 +6,11 @@
  *
  *  (PHP 5)
  *
- *   @copyright Copyright CiviCRM LLC (C) 2009
- *   @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html
+ * @copyright Copyright CiviCRM LLC (C) 2009
+ * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html
  *              GNU Affero General Public License version 3
- *   @version   $Id:
- *   @package   CiviCRM
+ * @version   $Id:
+ * @package   CiviCRM
  *
  *   This file is part of CiviCRM
  *
@@ -37,8 +37,8 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  *  Test APIv3 civicrm_activity_* functions
  *
- *  @package CiviCRM_APIv3
- *  @todo determine where help functions should sit (here or 'up the tree'), & best way to define API dir
+ * @package CiviCRM_APIv3
+ * @todo determine where help functions should sit (here or 'up the tree'), & best way to define API dir
  */
 class api_v3_APIStandardsTest extends CiviUnitTestCase {
 
@@ -61,6 +61,7 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
   public function setUp() {
     //  Connect to the database
     parent::setUp();
+    $this->useTransaction(TRUE);
     $this->_apiversion = 3;
     $this->_apiDir = "../api/v3/";
     $this->_functionFiles = array('Entity.php', 'utils.php');
@@ -93,11 +94,11 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
     );
   }
 
-  /*
-     * test checks that all v3 API return a standardised error message when
-     * the $params passed in is not an array.
-     */
-  function testParamsNotArray() {
+  /**
+   * Test checks that all v3 API return a standardised error message when
+   * the $params passed in is not an array.
+   */
+  public function testParamsNotArray() {
     /*I have commented this out as the check for is_array has been moved to civicrm_api. But keeping in place as
     * this test, in contrast to the standards test, tests all existing API rather than just CRUD ones
     * so want to keep code for re-use
@@ -107,27 +108,25 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
         $apiStdFunctions = $this->getAllAPIStdFunctions();
         $this->assertGreaterThan(1, count($apiStdFunctions),"something has gone wrong getting the std functions in line " . __LINE__);
         $params = 'string';
-        foreach($apiStdFunctions as $key => $function){
+        foreach ($apiStdFunctions as $key => $function) {
             if ( in_array( $function, $this->_skipFunctionList ) ) {
                 continue;
             }
             try {
                 $result = $function($params);
-            } catch ( Exception $e ) {
+            }
+            catch ( Exception $e ) {
               continue;
             }
 
         }*/
   }
 
-  /*
-     * Get all the files in the API directory for the relevant version which contain API functions
-     * @return array $files array of php files in the directory excluding helper files
-     */
   /**
-   * @return array
+   * Get all the files in the API directory for the relevant version which contain API functions
+   * @return array $files array of php files in the directory excluding helper files
    */
-  function getAllFilesinAPIDir() {
+  public function getAllFilesinAPIDir() {
     $files = array();
     $handle = opendir($this->_apiDir);
 
@@ -145,27 +144,22 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
     return $files;
   }
 
-  /*
-     * Require once  Files
-     * @files array list of files to load
-     */
   /**
+   * Require once  Files
    * @param $files
+   *   Array list of files to load.
    */
-  function requireOnceFilesArray($files) {
+  public function requireOnceFilesArray($files) {
     foreach ($files as $key => $file) {
       require_once $this->_apiDir . $file;
     }
   }
 
-  /*
-     * Get all api exposed functions that are expected to conform to standards
-     * @return array $functionlist
-     */
   /**
-   * @return array
+   * Get all api exposed functions that are expected to conform to standards
+   * @return array $functionlist
    */
-  function getAllAPIStdFunctions() {
+  public function getAllAPIStdFunctions() {
     $functionlist = get_defined_functions();
     $functions = preg_grep($this->_regexForGettingAPIStdFunctions, $functionlist['user']);
     foreach ($functions as $key => $function) {
@@ -179,4 +173,3 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
     return $functions;
   }
 }
-