/**
* Test class for API functions
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
class api_v3_APITest extends CiviUnitTestCase {
public $DBResetRequired = FALSE;
- protected $_apiversion =3;
+ protected $_apiversion = 3;
public function testAPIReplaceVariables() {
$result = array();
*/
public function testAPIWrapperIncludeNoFile() {
-
$result = $this->callAPIFailure('RandomFile', 'get', array(), 'API (RandomFile,get) does not exist (join the API team and implement it!)');
}
$this->assertEquals($expected, $actual, sprintf('input=%s expected=%s actual=%s', $input, $expected, $actual));
}
}
-/**
- * Test that calling via wrapper works
- */
+
+ /**
+ * Test that calling via wrapper works
+ */
public function testv3Wrapper() {
- try{
+ try {
$result = civicrm_api3('contact', 'get', array());
}
- catch (CRM_Exception $e){
+ catch (CRM_Exception $e) {
$this->fail("This should have been a success test");
}
$this->assertTrue(is_array($result));
/**
* Test exception is thrown
*/
- public function testv3WrapperException(){
- try{
+ public function testv3WrapperException() {
+ try {
$result = civicrm_api3('contact', 'create', array('debug' => 1));
}
- catch (CiviCRM_API3_Exception $e){
+ catch (CiviCRM_API3_Exception $e) {
$this->assertEquals('mandatory_missing', $e->getErrorCode());
$this->assertEquals('Mandatory key(s) missing from params array: contact_type', $e->getMessage());
$extra = $e->getExtraParams();