*
* (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
*
/**
* 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 {
/* This test case doesn't require DB reset */
-
public $DBResetRequired = FALSE;
/**
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');
* 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
$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
+ * array of php files in the directory excluding helper files
*/
- function getAllFilesinAPIDir() {
+ public function getAllFilesinAPIDir() {
$files = array();
$handle = opendir($this->_apiDir);
/**
* Require once Files
- * @param $files array list of files to load
+ * @param array $files
+ * 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
*/
- function getAllAPIStdFunctions() {
+ public function getAllAPIStdFunctions() {
$functionlist = get_defined_functions();
$functions = preg_grep($this->_regexForGettingAPIStdFunctions, $functionlist['user']);
foreach ($functions as $key => $function) {
return $functions;
}
}
-