Revert examples causing test failures
[civicrm-core.git] / api / v3 / examples / PaymentProcessor / Create.php
1 <?php
2 /**
3 * Test Generated example of using payment_processor create API.
4 *
5 * @return array
6 * API result array
7 */
8 function payment_processor_create_example() {
9 $params = array(
10 'name' => 'API Test PP',
11 'payment_processor_type_id' => 1,
12 'class_name' => 'CRM_Core_Payment_APITest',
13 'is_recur' => 0,
14 'domain_id' => 1,
15 );
16
17 try{
18 $result = civicrm_api3('payment_processor', 'create', $params);
19 }
20 catch (CiviCRM_API3_Exception $e) {
21 // Handle error here.
22 $errorMessage = $e->getMessage();
23 $errorCode = $e->getErrorCode();
24 $errorData = $e->getExtraParams();
25 return array(
26 'error' => $errorMessage,
27 'error_code' => $errorCode,
28 'error_data' => $errorData,
29 );
30 }
31
32 return $result;
33 }
34
35 /**
36 * Function returns array of result expected from previous function.
37 *
38 * @return array
39 * API result array
40 */
41 function payment_processor_create_expectedresult() {
42
43 $expectedResult = array(
44 'is_error' => 0,
45 'version' => 3,
46 'count' => 1,
47 'id' => 2,
48 'values' => array(
49 '2' => array(
50 'id' => '2',
51 'domain_id' => '1',
52 'name' => 'API Test PP',
53 'description' => '',
54 'payment_processor_type_id' => '18',
55 'is_active' => '',
56 'is_default' => 0,
57 'is_test' => 0,
58 'user_name' => '',
59 'password' => '',
60 'signature' => '',
61 'url_site' => '',
62 'url_api' => '',
63 'url_recur' => '',
64 'url_button' => '',
65 'subject' => '',
66 'class_name' => 'CRM_Core_Payment_APITest',
67 'billing_mode' => '1',
68 'is_recur' => 0,
69 'payment_type' => '1',
70 ),
71 ),
72 );
73
74 return $expectedResult;
75 }
76
77 /**
78 * This example has been generated from the API test suite.
79 * The test that created it is called
80 * testPaymentProcessorCreate
81 * and can be found in
82 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php
83 *
84 * You can see the outcome of the API tests at
85 * https://test.civicrm.org/job/CiviCRM-master-git/
86 *
87 * To Learn about the API read
88 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
89 *
90 * Browse the api on your own site with the api explorer
91 * http://MYSITE.ORG/path/to/civicrm/api
92 *
93 * Read more about testing here
94 * http://wiki.civicrm.org/confluence/display/CRM/Testing
95 *
96 * API Standards documentation:
97 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
98 */