Merge pull request #1865 from deepak-srivastava/act-report
[civicrm-core.git] / api / v3 / examples / DomainGet.php
1 <?php
2 /**
3 * Test Generated example of using domain get API
4 * *
5 */
6 function domain_get_example(){
7 $params = array(
8 'sequential' => 1,
9 );
10
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 }
21
22 return $result;
23 }
24
25 /**
26 * Function returns array of result expected from previous function
27 */
28 function domain_get_expectedresult(){
29
30 $expectedResult = array(
31 'is_error' => 0,
32 'version' => 3,
33 'count' => 2,
34 'values' => array(
35 '0' => array(
36 'id' => '1',
37 'name' => 'Default Domain Name',
38 'config_backend' => 'a:80:{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:1048576;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: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:10:"4.4.alpha1";}',
39 'version' => '3',
40 'contact_id' => '3',
41 'domain_email' => 'my@email.com',
42 'domain_phone' => array(
43 'phone_type' => 'Phone',
44 'phone' => '456-456',
45 ),
46 'domain_address' => array(
47 'street_address' => '45 Penny Lane',
48 'supplemental_address_1' => '',
49 'supplemental_address_2' => '',
50 'city' => '',
51 'state_province_id' => '',
52 'postal_code' => '',
53 'country_id' => '',
54 'geo_code_1' => '',
55 'geo_code_2' => '',
56 ),
57 'from_email' => 'info@EXAMPLE.ORG',
58 'from_name' => 'FIXME',
59 ),
60 '1' => array(
61 'id' => '2',
62 'name' => 'Second Domain',
63 'config_backend' => 'a:80:{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:1048576;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: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:10:"4.4.alpha1";}',
64 'version' => '4.3.alpha1',
65 'contact_id' => '2',
66 'domain_email' => '"Domain Email" <domainemail2@example.org>',
67 'domain_phone' => array(
68 'phone_type' => 'Phone',
69 'phone' => '204 555-1001',
70 ),
71 'domain_address' => array(
72 'street_address' => '15 Main St',
73 'supplemental_address_1' => '',
74 'supplemental_address_2' => '',
75 'city' => 'Collinsville',
76 'state_province_id' => '1006',
77 'postal_code' => '6022',
78 'country_id' => '1228',
79 'geo_code_1' => '41.8328',
80 'geo_code_2' => '-72.9253',
81 ),
82 'from_email' => 'info@EXAMPLE.ORG',
83 'from_name' => 'FIXME',
84 ),
85 ),
86 );
87
88 return $expectedResult;
89 }
90
91
92 /*
93 * This example has been generated from the API test suite. The test that created it is called
94 *
95 * testGet and can be found in
96 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/DomainTest.php
97 *
98 * You can see the outcome of the API tests at
99 * http://tests.dev.civicrm.org/trunk/results-api_v3
100 *
101 * To Learn about the API read
102 * http://book.civicrm.org/developer/current/techniques/api/
103 *
104 * and review the wiki at
105 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
106 *
107 * Read more about testing here
108 * http://wiki.civicrm.org/confluence/display/CRM/Testing
109 *
110 * API Standards documentation:
111 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
112 */