Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using domain get API | |
4 | * * | |
6a488035 TO |
5 | */ |
6 | function domain_get_example(){ | |
791c263c | 7 | $params = array( |
6a488035 TO |
8 | 'sequential' => 1, |
9 | ); | |
10 | ||
fb32de45 | 11 | try{ |
12 | $result = civicrm_api3('domain', 'get', $params); | |
13 | } | |
14 | catch (CiviCRM_API3_Exception $e) { | |
15 | // handle error here | |
16 | $errorMessage = $e->getMessage(); | |
17 | $errorCode = $e->getErrorCode(); | |
18 | $errorData = $e->getExtraParams(); | |
19 | return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); | |
20 | } | |
6a488035 | 21 | |
fb32de45 | 22 | return $result; |
6a488035 TO |
23 | } |
24 | ||
fb32de45 | 25 | /** |
6a488035 TO |
26 | * Function returns array of result expected from previous function |
27 | */ | |
28 | function domain_get_expectedresult(){ | |
29 | ||
791c263c | 30 | $expectedResult = array( |
6a488035 TO |
31 | 'is_error' => 0, |
32 | 'version' => 3, | |
33 | 'count' => 2, | |
791c263c | 34 | 'values' => array( |
35 | '0' => array( | |
6a488035 TO |
36 | 'id' => '1', |
37 | 'name' => 'Default Domain Name', | |
69d79249 | 38 | 'config_backend' => 'a:82:{s:10:\"userSystem\";O:26:\"CRM_Utils_System_UnitTests\":4:{s:9:\"is_drupal\";b:0;s:9:\"is_joomla\";b:0;s:12:\"is_wordpress\";b:0;s:24:\"supports_form_extensions\";b:0;}s:11:\"initialized\";i:0;s:15:\"DAOFactoryClass\";s:23:\"CRM_Contact_DAO_Factory\";s:17:\"componentRegistry\";O:18:\"CRM_Core_Component\":0:{}s:9:\"inCiviCRM\";b:0;s:18:\"recaptchaPublicKey\";N;s:5:\"debug\";i:0;s:9:\"backtrace\";i:0;s:12:\"resourceBase\";N;s:13:\"extensionsURL\";N;s:12:\"countryLimit\";a:1:{i:0;s:4:\"1228\";}s:27:\"defaultContactStateProvince\";N;s:13:\"provinceLimit\";a:1:{i:0;s:4:\"1228\";}s:21:\"defaultContactCountry\";s:4:\"1228\";s:15:\"defaultCurrency\";s:3:\"USD\";s:10:\"lcMessages\";s:5:\"en_US\";s:18:\"dateformatDatetime\";s:20:\"%B %E%f, %Y %l:%M %P\";s:14:\"dateformatFull\";s:11:\"%B %E%f, %Y\";s:17:\"dateformatPartial\";s:5:\"%B %Y\";s:14:\"dateformatYear\";s:2:\"%Y\";s:14:\"dateformatTime\";s:8:\"%l:%M %P\";s:15:\"timeInputFormat\";i:1;s:15:\"dateInputFormat\";s:8:\"mm/dd/yy\";s:15:\"fiscalYearStart\";a:2:{s:1:\"M\";i:1;s:1:\"d\";i:1;}s:11:\"moneyformat\";s:5:\"%c %a\";s:16:\"moneyvalueformat\";s:3:\"%!i\";s:15:\"currencySymbols\";s:0:\"\";s:21:\"defaultCurrencySymbol\";s:1:\"$\";s:20:\"monetaryDecimalPoint\";s:1:\".\";s:25:\"monetaryThousandSeparator\";s:1:\",\";s:14:\"gettextCodeset\";s:5:\"utf-8\";s:13:\"gettextDomain\";s:7:\"civicrm\";s:27:\"userFrameworkUsersTableName\";s:5:\"users\";s:21:\"userFrameworkFrontend\";b:0;s:20:\"userFrameworkLogging\";b:0;s:17:\"maxImportFileSize\";i:2097152;s:11:\"maxFileSize\";i:2;s:11:\"mapProvider\";N;s:9:\"mapAPIKey\";N;s:11:\"geoProvider\";N;s:9:\"geoAPIKey\";N;s:13:\"geocodeMethod\";s:0:\"\";s:12:\"mapGeoCoding\";i:1;s:7:\"logging\";b:0;s:12:\"versionCheck\";b:1;s:16:\"enableComponents\";a:6:{i:0;s:14:\"CiviContribute\";i:1;s:10:\"CiviPledge\";i:2;s:10:\"CiviMember\";i:3;s:9:\"CiviEvent\";i:4;s:8:\"CiviMail\";i:5;s:10:\"CiviReport\";}s:18:\"enableComponentIDs\";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:\"enableSSL\";b:0;s:18:\"fatalErrorTemplate\";s:20:\"CRM/common/fatal.tpl\";s:17:\"fatalErrorHandler\";N;s:14:\"legacyEncoding\";s:12:\"Windows-1252\";s:14:\"fieldSeparator\";s:1:\",\";s:17:\"maxLocationBlocks\";i:2;s:15:\"captchaFontPath\";s:25:\"/usr/X11R6/lib/X11/fonts/\";s:11:\"captchaFont\";s:17:\"HelveticaBold.ttf\";s:21:\"includeWildCardInName\";i:1;s:18:\"includeEmailInName\";i:1;s:21:\"includeNickNameInName\";i:0;s:22:\"smartGroupCacheTimeout\";i:5;s:22:\"defaultSearchProfileID\";N;s:21:\"dashboardCacheTimeout\";i:1440;s:15:\"doNotResetCache\";i:0;s:24:\"includeAlphabeticalPager\";i:1;s:20:\"includeOrderByClause\";i:1;s:13:\"oldInputStyle\";i:1;s:14:\"formKeyDisable\";b:0;s:21:\"doNotAttachPDFReceipt\";b:0;s:15:\"wkhtmltopdfPath\";b:0;s:23:\"secondDegRelPermissions\";b:0;s:10:\"wpBasePage\";N;s:9:\"groupTree\";b:0;s:11:\"revampPages\";a:0:{}s:13:\"verpSeparator\";s:1:\".\";s:12:\"mailerPeriod\";i:180;s:16:\"mailerSpoolLimit\";i:0;s:16:\"mailerBatchLimit\";i:0;s:13:\"mailerJobSize\";i:0;s:13:\"mailerJobsMax\";i:0;s:16:\"mailThrottleTime\";i:0;s:12:\"customCSSURL\";N;s:15:\"civiRelativeURL\";s:13:\"/index.php?q=\";s:11:\"civiVersion\";s:5:\"4.4.5\";}', |
6a488035 TO |
39 | 'version' => '3', |
40 | 'contact_id' => '3', | |
b259a4ab | 41 | 'locale_custom_strings' => 'a:1:{s:5:\"en_US\";a:0:{}}', |
6a488035 | 42 | 'domain_email' => 'my@email.com', |
791c263c | 43 | 'domain_phone' => array( |
6a488035 TO |
44 | 'phone_type' => 'Phone', |
45 | 'phone' => '456-456', | |
46 | ), | |
791c263c | 47 | 'domain_address' => array( |
6a488035 TO |
48 | 'street_address' => '45 Penny Lane', |
49 | 'supplemental_address_1' => '', | |
50 | 'supplemental_address_2' => '', | |
51 | 'city' => '', | |
52 | 'state_province_id' => '', | |
53 | 'postal_code' => '', | |
54 | 'country_id' => '', | |
55 | 'geo_code_1' => '', | |
56 | 'geo_code_2' => '', | |
57 | ), | |
58 | 'from_email' => 'info@EXAMPLE.ORG', | |
59 | 'from_name' => 'FIXME', | |
60 | ), | |
791c263c | 61 | '1' => array( |
6a488035 TO |
62 | 'id' => '2', |
63 | 'name' => 'Second Domain', | |
69d79249 | 64 | 'config_backend' => 'a:82:{s:10:\"userSystem\";O:26:\"CRM_Utils_System_UnitTests\":4:{s:9:\"is_drupal\";b:0;s:9:\"is_joomla\";b:0;s:12:\"is_wordpress\";b:0;s:24:\"supports_form_extensions\";b:0;}s:11:\"initialized\";i:0;s:15:\"DAOFactoryClass\";s:23:\"CRM_Contact_DAO_Factory\";s:17:\"componentRegistry\";O:18:\"CRM_Core_Component\":0:{}s:9:\"inCiviCRM\";b:0;s:18:\"recaptchaPublicKey\";N;s:5:\"debug\";i:0;s:9:\"backtrace\";i:0;s:12:\"resourceBase\";N;s:13:\"extensionsURL\";N;s:12:\"countryLimit\";a:1:{i:0;s:4:\"1228\";}s:27:\"defaultContactStateProvince\";N;s:13:\"provinceLimit\";a:1:{i:0;s:4:\"1228\";}s:21:\"defaultContactCountry\";s:4:\"1228\";s:15:\"defaultCurrency\";s:3:\"USD\";s:10:\"lcMessages\";s:5:\"en_US\";s:18:\"dateformatDatetime\";s:20:\"%B %E%f, %Y %l:%M %P\";s:14:\"dateformatFull\";s:11:\"%B %E%f, %Y\";s:17:\"dateformatPartial\";s:5:\"%B %Y\";s:14:\"dateformatYear\";s:2:\"%Y\";s:14:\"dateformatTime\";s:8:\"%l:%M %P\";s:15:\"timeInputFormat\";i:1;s:15:\"dateInputFormat\";s:8:\"mm/dd/yy\";s:15:\"fiscalYearStart\";a:2:{s:1:\"M\";i:1;s:1:\"d\";i:1;}s:11:\"moneyformat\";s:5:\"%c %a\";s:16:\"moneyvalueformat\";s:3:\"%!i\";s:15:\"currencySymbols\";s:0:\"\";s:21:\"defaultCurrencySymbol\";s:1:\"$\";s:20:\"monetaryDecimalPoint\";s:1:\".\";s:25:\"monetaryThousandSeparator\";s:1:\",\";s:14:\"gettextCodeset\";s:5:\"utf-8\";s:13:\"gettextDomain\";s:7:\"civicrm\";s:27:\"userFrameworkUsersTableName\";s:5:\"users\";s:21:\"userFrameworkFrontend\";b:0;s:20:\"userFrameworkLogging\";b:0;s:17:\"maxImportFileSize\";i:2097152;s:11:\"maxFileSize\";i:2;s:11:\"mapProvider\";N;s:9:\"mapAPIKey\";N;s:11:\"geoProvider\";N;s:9:\"geoAPIKey\";N;s:13:\"geocodeMethod\";s:0:\"\";s:12:\"mapGeoCoding\";i:1;s:7:\"logging\";b:0;s:12:\"versionCheck\";b:1;s:16:\"enableComponents\";a:6:{i:0;s:14:\"CiviContribute\";i:1;s:10:\"CiviPledge\";i:2;s:10:\"CiviMember\";i:3;s:9:\"CiviEvent\";i:4;s:8:\"CiviMail\";i:5;s:10:\"CiviReport\";}s:18:\"enableComponentIDs\";a:6:{i:0;i:1;i:1;i:6;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:8;}s:9:\"enableSSL\";b:0;s:18:\"fatalErrorTemplate\";s:20:\"CRM/common/fatal.tpl\";s:17:\"fatalErrorHandler\";N;s:14:\"legacyEncoding\";s:12:\"Windows-1252\";s:14:\"fieldSeparator\";s:1:\",\";s:17:\"maxLocationBlocks\";i:2;s:15:\"captchaFontPath\";s:25:\"/usr/X11R6/lib/X11/fonts/\";s:11:\"captchaFont\";s:17:\"HelveticaBold.ttf\";s:21:\"includeWildCardInName\";i:1;s:18:\"includeEmailInName\";i:1;s:21:\"includeNickNameInName\";i:0;s:22:\"smartGroupCacheTimeout\";i:5;s:22:\"defaultSearchProfileID\";N;s:21:\"dashboardCacheTimeout\";i:1440;s:15:\"doNotResetCache\";i:0;s:24:\"includeAlphabeticalPager\";i:1;s:20:\"includeOrderByClause\";i:1;s:13:\"oldInputStyle\";i:1;s:14:\"formKeyDisable\";b:0;s:21:\"doNotAttachPDFReceipt\";b:0;s:15:\"wkhtmltopdfPath\";b:0;s:23:\"secondDegRelPermissions\";b:0;s:10:\"wpBasePage\";N;s:9:\"groupTree\";b:0;s:11:\"revampPages\";a:0:{}s:13:\"verpSeparator\";s:1:\".\";s:12:\"mailerPeriod\";i:180;s:16:\"mailerSpoolLimit\";i:0;s:16:\"mailerBatchLimit\";i:0;s:13:\"mailerJobSize\";i:0;s:13:\"mailerJobsMax\";i:0;s:16:\"mailThrottleTime\";i:0;s:12:\"customCSSURL\";N;s:15:\"civiRelativeURL\";s:13:\"/index.php?q=\";s:11:\"civiVersion\";s:5:\"4.4.5\";}', |
6a488035 TO |
65 | 'version' => '4.3.alpha1', |
66 | 'contact_id' => '2', | |
b259a4ab | 67 | 'domain_email' => '\"Domain Email\" <domainemail2@example.org>', |
791c263c | 68 | 'domain_phone' => array( |
6a488035 TO |
69 | 'phone_type' => 'Phone', |
70 | 'phone' => '204 555-1001', | |
71 | ), | |
791c263c | 72 | 'domain_address' => array( |
6a488035 TO |
73 | 'street_address' => '15 Main St', |
74 | 'supplemental_address_1' => '', | |
75 | 'supplemental_address_2' => '', | |
76 | 'city' => 'Collinsville', | |
77 | 'state_province_id' => '1006', | |
78 | 'postal_code' => '6022', | |
79 | 'country_id' => '1228', | |
80 | 'geo_code_1' => '41.8328', | |
81 | 'geo_code_2' => '-72.9253', | |
82 | ), | |
83 | 'from_email' => 'info@EXAMPLE.ORG', | |
84 | 'from_name' => 'FIXME', | |
85 | ), | |
86 | ), | |
87 | ); | |
88 | ||
fb32de45 | 89 | return $expectedResult; |
6a488035 TO |
90 | } |
91 | ||
92 | ||
93 | /* | |
94 | * This example has been generated from the API test suite. The test that created it is called | |
95 | * | |
96 | * testGet and can be found in | |
69d79249 | 97 | * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php |
6a488035 TO |
98 | * |
99 | * You can see the outcome of the API tests at | |
69d79249 | 100 | * https://test.civicrm.org/job/CiviCRM-master-git/ |
6a488035 TO |
101 | * |
102 | * To Learn about the API read | |
69d79249 | 103 | * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API |
6a488035 | 104 | * |
69d79249 E |
105 | * Browse the api on your own site with the api explorer |
106 | * http://MYSITE.ORG/path/to/civicrm/api/explorer | |
6a488035 TO |
107 | * |
108 | * Read more about testing here | |
109 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
110 | * | |
111 | * API Standards documentation: | |
112 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
b259a4ab | 113 | */ |