INFRA-132 - Add space before "{"
[civicrm-core.git] / tests / phpunit / api / v3 / APIStandardsTest.php
index ce39f7732dac90d12d35ff8f7ded7f977edcb5a2..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');
@@ -97,7 +98,7 @@ 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() {
+  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,13 +108,14 @@ 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;
             }
 
@@ -124,7 +126,7 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
    * 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);
 
@@ -144,9 +146,10 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
 
   /**
    * Require once  Files
-   * @param $files array list of files to load
+   * @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;
     }
@@ -156,7 +159,7 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
    * 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) {
@@ -170,4 +173,3 @@ class api_v3_APIStandardsTest extends CiviUnitTestCase {
     return $functions;
   }
 }
-