Merge pull request #4909 from pratikshad/broken-webtest
[civicrm-core.git] / tests / phpunit / api / v3 / APITest.php
index 03e93285158719219bb4cce2bb2f0d4bd9f23a61..5682e91a8951e45a571b6f777992b716687c57a5 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -31,33 +31,14 @@ require_once 'CiviTest/CiviUnitTestCase.php';
 /**
  * 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;
-
-  /**
-   * Sets up the fixture, for example, opens a network connection.
-   * This method is called before a test is executed.
-   *
-   * @access protected
-   */
-  protected function setUp() {
-    parent::setUp();
-  }
-
-  /**
-   * Tears down the fixture, for example, closes a network connection.
-   * This method is called after a test is executed.
-   *
-   * @access protected
-   */
-  protected function tearDown() {}
-
-  function testAPIReplaceVariables() {
+  public function testAPIReplaceVariables() {
     $result = array();
     $result['testfield'] = 6;
     $result['api.tag.get'] = 999;
@@ -90,21 +71,20 @@ class api_v3_APITest extends CiviUnitTestCase {
   /*
     * test that error doesn't occur for non-existant file
     */
-  function testAPIWrapperIncludeNoFile() {
-
+  public function testAPIWrapperIncludeNoFile() {
 
     $result = $this->callAPIFailure('RandomFile', 'get', array(), 'API (RandomFile,get) does not exist (join the API team and implement it!)');
   }
 
-  function testAPIWrapperCamelCaseFunction() {
+  public function testAPIWrapperCamelCaseFunction() {
     $result = $this->callAPISuccess('OptionGroup', 'Get', array());
   }
 
-  function testAPIWrapperLcaseFunction() {
+  public function testAPIWrapperLcaseFunction() {
     $result = $this->callAPISuccess('OptionGroup', 'get', array());
   }
 
-  function testAPIResolver() {
+  public function testAPIResolver() {
     $oldpath = get_include_path();
     set_include_path($oldpath . PATH_SEPARATOR . dirname(__FILE__) . '/dataset/resolver');
 
@@ -118,7 +98,7 @@ class api_v3_APITest extends CiviUnitTestCase {
     set_include_path($oldpath);
   }
 
-  function testFromCamel() {
+  public function testFromCamel() {
     $cases = array(
       'Contribution' => 'contribution',
       'contribution' => 'contribution',
@@ -135,7 +115,7 @@ class api_v3_APITest extends CiviUnitTestCase {
     }
   }
 
-  function testToCamel() {
+  public function testToCamel() {
     $cases = array(
       'Contribution' => 'Contribution',
       'contribution' => 'Contribution',
@@ -151,14 +131,15 @@ class api_v3_APITest extends CiviUnitTestCase {
       $this->assertEquals($expected, $actual, sprintf('input=%s expected=%s actual=%s', $input, $expected, $actual));
     }
   }
-/**
- * Test that calling via wrapper works
- */
-  function testv3Wrapper() {
-    try{
+
+  /**
+   * Test that calling via wrapper works
+   */
+  public function testv3Wrapper() {
+    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));
@@ -166,13 +147,13 @@ class api_v3_APITest extends CiviUnitTestCase {
   }
 
   /**
-   * test exception is thrown
+   * Test exception is thrown
    */
-  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();
@@ -215,4 +196,3 @@ class api_v3_APITest extends CiviUnitTestCase {
   }
 
 }
-