<?php
-// $Id$
-
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
*/
class api_v3_PaymentProcessorTest extends CiviUnitTestCase {
protected $_paymentProcessorType;
- protected $_apiversion;
+ protected $_apiversion = 3;
protected $_params;
public $_eNoticeCompliant = TRUE;
function get_info() {
function setUp() {
parent::setUp();
- $this->_apiversion = 3;
// Create dummy processor
$params = array(
- 'version' => $this->_apiversion,
'name' => 'API_Test_PP_Type',
'title' => 'API Test Payment Processor Type',
'class_name' => 'CRM_Core_Payment_APITest',
'billing_mode' => 'form',
'is_recur' => 0,
);
- $result = civicrm_api('payment_processor_type', 'create', $params);
+ $result = $this->callAPISuccess('payment_processor_type', 'create', $params);
$this->_paymentProcessorType = $result['id'];
$this->_params = array(
- 'version' => $this->_apiversion,
'name' => 'API Test PP',
'payment_processor_type_id' => $this->_paymentProcessorType,
'class_name' => 'CRM_Core_Payment_APITest',
function testPaymentProcessorCreateWithoutName() {
$payProcParams = array(
'is_active' => 1,
- 'version' => $this->_apiversion,
);
- $result = civicrm_api('payment_processor', 'create', $payProcParams);
-
- $this->assertEquals($result['is_error'], 1);
+ $result = $this->callAPIFailure('payment_processor', 'create', $payProcParams);
}
/**
*/
function testPaymentProcessorCreate() {
$params = $this->_params;
- $result = civicrm_api('payment_processor', 'create', $params);
- $this->documentMe($params, $result, __FUNCTION__, __FILE__);
+ $result = $this->callAPIAndDocument('payment_processor', 'create', $params, __FUNCTION__, __FILE__);
$this->assertNotNull($result['id'], 'in line ' . __LINE__);
- // mutate $params to match expected return value
- unset($params['version']);
//assertDBState compares expected values in $result to actual values in the DB
$this->assertDBState('CRM_Financial_DAO_PaymentProcessor', $result['id'], $params);
return $result['id'];
require_once 'api/v3/examples/PaymentProcessorCreate.php';
$result = payment_processor_create_example();
$expectedResult = payment_processor_create_expectedresult();
- $this->assertEquals($result['is_error'], 0);
+ $this->assertAPISuccess($result);
}
///////////////// civicrm_payment_processor_delete methods
/**
- * check payment processor type delete
+ * check payment processor delete
*/
function testPaymentProcessorDelete() {
$id = $this->testPaymentProcessorCreate();
- // create sample payment processor type.
$params = array(
'id' => $id,
- 'version' => $this->_apiversion,
);
- $result = civicrm_api('payment_processor', 'delete', $params);
- $this->documentMe($params, $result, __FUNCTION__, __FILE__);
- $this->assertEquals($result['is_error'], 0);
+ $result = $this->callAPIAndDocument('payment_processor', 'delete', $params, __FUNCTION__, __FILE__);
}
///////////////// civicrm_payment_processors_get methods
function testPaymentProcessorsGet() {
$params = $this->_params;
$params['user_name'] = 'test@test.com';
- civicrm_api('payment_processor', 'create', $params);
+ $this->callAPISuccess('payment_processor', 'create', $params);
$params = array(
'user_name' => 'test@test.com',
- 'version' => $this->_apiversion,
);
- $results = civicrm_api('payment_processor', 'get', $params);
+ $results = $this->callAPISuccess('payment_processor', 'get', $params);
- $this->assertEquals(0, $results['is_error'], ' in line ' . __LINE__);
$this->assertEquals(1, $results['count'], ' in line ' . __LINE__);
$this->assertEquals('test@test.com', $results['values'][$results['id']]['user_name'], ' in line ' . __LINE__);
}