Merge pull request #6289 from yashodha/CRM-16879
[civicrm-core.git] / tests / phpunit / api / v3 / PaymentProcessorTypeTest.php
index 114e5d56ed69d7e8f967ec78ba1f69241a8a4f2c..5cc2a0e3a2a527453ee9f261295c912bdcd24c56 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -23,7 +23,7 @@
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 require_once 'CiviTest/CiviUnitTestCase.php';
 
@@ -42,22 +42,23 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
     $this->_apiversion = 3;
   }
 
-//  function tearDown() {
-//
-//    $tablesToTruncate = array(
-//      'civicrm_payment_processor_type',
-//    );
-//    $this->quickCleanup($tablesToTruncate);
-//  }
+  //  function tearDown() {
+  //
+  //    $tablesToTruncate = array(
+  //      'civicrm_payment_processor_type',
+  //    );
+  //    $this->quickCleanup($tablesToTruncate);
+  //  }
 
   ///////////////// civicrm_payment_processor_type_add methods
 
   /**
-   * Check with no name
+   * Check with no name.
    */
   public function testPaymentProcessorTypeCreateWithoutName() {
     $payProcParams = array(
-      'is_active' => 1,    );
+      'is_active' => 1,
+    );
     $result = $this->callAPIFailure('payment_processor_type', 'create', $payProcParams);
     $this->assertEquals($result['error_message'],
       'Mandatory key(s) missing from params array: name, title, class_name, billing_mode'
@@ -65,10 +66,11 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   }
 
   /**
-   * Create payment processor type
+   * Create payment processor type.
    */
   public function testPaymentProcessorTypeCreate() {
-    $params = array(      'sequential' => 1,
+    $params = array(
+      'sequential' => 1,
       'name' => 'API_Test_PP',
       'title' => 'API Test Payment Processor',
       'class_name' => 'CRM_Core_Payment_APITest',
@@ -86,7 +88,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   }
 
   /**
-   *  Test  using example code
+   * Test  using example code.
    */
   public function testPaymentProcessorTypeCreateExample() {
     require_once 'api/v3/examples/PaymentProcessorType/Create.php';
@@ -98,7 +100,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   ///////////////// civicrm_payment_processor_type_delete methods
 
   /**
-   * Check with empty array
+   * Check with empty array.
    */
   public function testPaymentProcessorTypeDeleteEmpty() {
     $params = array();
@@ -106,14 +108,14 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with No array
+   * Check with No array.
    */
   public function testPaymentProcessorTypeDeleteParamsNotArray() {
     $result = $this->callAPIFailure('payment_processor_type', 'delete', 'string');
   }
 
   /**
-   * Check if required fields are not passed
+   * Check if required fields are not passed.
    */
   public function testPaymentProcessorTypeDeleteWithoutRequired() {
     $params = array(
@@ -127,14 +129,14 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with incorrect required fields
+   * Check with incorrect required fields.
    */
   public function testPaymentProcessorTypeDeleteWithIncorrectData() {
     $result = $this->callAPIFailure('payment_processor_type', 'delete', array('id' => 'abcd'));
   }
 
   /**
-   * Check payment processor type delete
+   * Check payment processor type delete.
    */
   public function testPaymentProcessorTypeDelete() {
     $payProcType = $this->paymentProcessorTypeCreate();
@@ -148,7 +150,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   ///////////////// civicrm_payment_processor_type_update
 
   /**
-   * Check with empty array
+   * Check with empty array.
    */
   public function testPaymentProcessorTypeUpdateEmpty() {
     $params = array();
@@ -157,7 +159,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with No array
+   * Check with No array.
    */
   public function testPaymentProcessorTypeUpdateParamsNotArray() {
     $result = $this->callAPIFailure('payment_processor_type', 'create', 'string');
@@ -165,7 +167,7 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   }
 
   /**
-   * Check with all parameters
+   * Check with all parameters.
    */
   public function testPaymentProcessorTypeUpdate() {
     // create sample payment processor type.
@@ -177,7 +179,8 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
       'title' => 'API Test Payment Processor 2',
       'class_name' => 'CRM_Core_Payment_APITest 2',
       'billing_mode' => 2,
-      'is_recur' => 0,    );
+      'is_recur' => 0,
+    );
 
     $result = $this->callAPISuccess('payment_processor_type', 'create', $params);
     $this->assertNotNull($result['id']);
@@ -188,10 +191,10 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
   ///////////////// civicrm_payment_processor_types_get methods
 
   /**
-   * Check with empty array
+   * Check with empty array.
    */
   public function testPaymentProcessorTypesGetEmptyParams() {
-    $results = $this->callAPISuccess('payment_processor_type', 'get', array(    ));
+    $results = $this->callAPISuccess('payment_processor_type', 'get', array());
     $baselineCount = $results['count'];
 
     $firstRelTypeParams = array(
@@ -199,7 +202,8 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
       'title' => 'API Test Payment Processor',
       'class_name' => 'CRM_Core_Payment_APITest',
       'billing_mode' => 1,
-      'is_recur' => 0,    );
+      'is_recur' => 0,
+    );
 
     $first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams);
 
@@ -208,9 +212,10 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
       'title' => 'API Test Payment Processor 2',
       'class_name' => 'CRM_Core_Payment_APITest 2',
       'billing_mode' => 2,
-      'is_recur' => 0,    );
+      'is_recur' => 0,
+    );
     $second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams);
-    $result = $this->callAPISuccess('payment_processor_type', 'get', array(    ));
+    $result = $this->callAPISuccess('payment_processor_type', 'get', array());
 
     $this->assertEquals($baselineCount + 2, $result['count']);
     $this->assertAPISuccess($result);
@@ -225,7 +230,8 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
       'title' => 'API Test Payment Processor 11',
       'class_name' => 'CRM_Core_Payment_APITest_11',
       'billing_mode' => 1,
-      'is_recur' => 0,    );
+      'is_recur' => 0,
+    );
 
     $first = $this->callAPISuccess('PaymentProcessorType', 'Create', $firstRelTypeParams);
 
@@ -234,15 +240,18 @@ class api_v3_PaymentProcessorTypeTest extends CiviUnitTestCase {
       'title' => 'API Test Payment Processor 12',
       'class_name' => 'CRM_Core_Payment_APITest_12',
       'billing_mode' => 2,
-      'is_recur' => 0,    );
+      'is_recur' => 0,
+    );
     $second = $this->callAPISuccess('PaymentProcessorType', 'Create', $secondRelTypeParams);
 
     $params = array(
-      'name' => 'API_Test_PP_12',    );
+      'name' => 'API_Test_PP_12',
+    );
     $result = $this->callAPISuccess('payment_processor_type', 'get', $params);
 
     $this->assertAPISuccess($result);
     $this->assertEquals(1, $result['count'], ' in line ' . __LINE__);
     $this->assertEquals('CRM_Core_Payment_APITest_12', $result['values'][$result['id']]['class_name'], ' in line ' . __LINE__);
   }
+
 }