Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC] Update Examples #15085

Merged
merged 1 commit into from
Aug 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Civi/Test/Api3DocTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ private function documentMe($entity, $action, $params, $result, $testFunction, $
mkdir($civicrm_root . "/api/v3/examples/$entity");
}
$f = fopen($civicrm_root . "/api/v3/examples/$entity/$exampleName.php", "w+b");
fwrite($f, $smarty->fetch($civicrm_root . '/tests/templates/documentFunction.tpl'));
$contents = $smarty->fetch($civicrm_root . '/tests/templates/documentFunction.tpl');
$contents = \CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents);
fwrite($f, $contents);
fclose($f);
}
}
Expand Down
50 changes: 23 additions & 27 deletions api/v3/examples/Activity/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
*/
function activity_get_example() {
$params = [
'contact_id' => 1,
'activity_type_id' => 9999,
'sequential' => 1,
'return.custom_1' => 1,
'case_id' => [
'IS NULL' => 1,
],
];

try{
Expand Down Expand Up @@ -44,28 +43,25 @@ function activity_get_expectedresult() {
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 1,
'id' => 9,
'values' => [
'0' => [
'id' => '1',
'activity_type_id' => '9999',
'subject' => 'test activity type id',
'activity_date_time' => '2011-06-02 14:36:13',
'duration' => '120',
'location' => 'Pennsylvania',
'details' => 'a test activity',
'9' => [
'id' => '9',
'activity_type_id' => '2',
'subject' => 'Ask not what your API can do for you, but what you can do for your API.',
'activity_date_time' => '2019-08-20 19:10:43',
'status_id' => '2',
'priority_id' => '1',
'priority_id' => '2',
'is_test' => 0,
'is_auto' => 0,
'is_current_revision' => '1',
'is_deleted' => 0,
'is_star' => 0,
'custom_1' => 'custom string',
'source_contact_id' => '1',
'status' => 'Completed',
'activity_name' => 'Test activity type',
'custom_1_1' => 'custom string',
'created_date' => '2013-07-28 08:49:19',
'modified_date' => '2012-11-14 16:02:35',
'source_contact_id' => '19',
'source_contact_name' => 'Mr. Anthony Anderson II',
'source_contact_sort_name' => 'Anderson, Anthony',
],
],
];
Expand All @@ -75,22 +71,22 @@ function activity_get_expectedresult() {

/*
* This example has been generated from the API test suite.
* The test that created it is called "testActivityGetContact_idCustom"
* The test that created it is called "testGet"
* and can be found at:
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityCaseTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
12 changes: 6 additions & 6 deletions api/v3/examples/ActivityContact/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,17 @@ function activity_contact_create_expectedresult() {
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
14 changes: 7 additions & 7 deletions api/v3/examples/ActivityContact/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
function activity_contact_delete_example() {
$params = [
'id' => 8,
'id' => 11,
];

try{
Expand Down Expand Up @@ -54,17 +54,17 @@ function activity_contact_delete_expectedresult() {
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
18 changes: 9 additions & 9 deletions api/v3/examples/ActivityType/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ function activity_type_create_expectedresult() {
'is_error' => 0,
'version' => 3,
'count' => 1,
'id' => 849,
'id' => 869,
'values' => [
'849' => [
'id' => '849',
'869' => [
'id' => '869',
'option_group_id' => '2',
'label' => 'send out letters',
'value' => '55',
Expand Down Expand Up @@ -85,17 +85,17 @@ function activity_type_create_expectedresult() {
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
35 changes: 8 additions & 27 deletions api/v3/examples/ActivityType/Get.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function activity_type_get_expectedresult() {
$expectedResult = [
'is_error' => 0,
'version' => 3,
'count' => 54,
'count' => 35,
'values' => [
'1' => 'Meeting',
'2' => 'Phone Call',
Expand All @@ -55,27 +55,9 @@ function activity_type_get_expectedresult() {
'10' => 'Pledge Acknowledgment',
'11' => 'Pledge Reminder',
'12' => 'Inbound Email',
'13' => 'Open Case',
'14' => 'Follow up',
'15' => 'Change Case Type',
'16' => 'Change Case Status',
'17' => 'Membership Renewal Reminder',
'18' => 'Change Case Start Date',
'19' => 'Bulk Email',
'20' => 'Assign Case Role',
'21' => 'Remove Case Role',
'22' => 'Print/Merge Document',
'23' => 'Merge Case',
'24' => 'Reassigned Case',
'25' => 'Link Cases',
'26' => 'Change Case Tags',
'27' => 'Add Client To Case',
'28' => 'Survey',
'29' => 'Canvass',
'30' => 'PhoneBank',
'31' => 'WalkList',
'32' => 'Petition Signature',
'33' => 'Change Custom Data',
'34' => 'Mass SMS',
'35' => 'Change Membership Status',
'36' => 'Change Membership Type',
Expand All @@ -95,8 +77,7 @@ function activity_type_get_expectedresult() {
'50' => 'Emailed Invoice',
'51' => 'Contact Merged',
'52' => 'Contact Deleted by Merge',
'53' => 'Failed Payment',
'54' => 'Close Accounting Period',
'54' => 'Failed Payment',
],
'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.',
];
Expand All @@ -111,17 +92,17 @@ function activity_type_get_expectedresult() {
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
16 changes: 8 additions & 8 deletions api/v3/examples/Address/AddressLike.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function address_get_expectedresult() {
'values' => [
'0' => [
'id' => '1',
'contact_id' => '20',
'location_type_id' => '18',
'contact_id' => '4',
'location_type_id' => '33',
'is_primary' => '1',
'is_billing' => 0,
'street_address' => 'Ambachtstraat 23',
Expand All @@ -75,17 +75,17 @@ function address_get_expectedresult() {
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
16 changes: 8 additions & 8 deletions api/v3/examples/Address/AddressParse.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function address_create_example() {
$params = [
'street_parsing' => 1,
'street_address' => '54A Excelsior Ave. Apt 1C',
'location_type_id' => 7,
'location_type_id' => 8,
'contact_id' => 4,
];

Expand Down Expand Up @@ -51,7 +51,7 @@ function address_create_expectedresult() {
'1' => [
'id' => '1',
'contact_id' => '4',
'location_type_id' => '7',
'location_type_id' => '8',
'is_primary' => '1',
'is_billing' => 0,
'street_address' => '54A Excelsior Ave. Apt 1C',
Expand All @@ -74,17 +74,17 @@ function address_create_expectedresult() {
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
20 changes: 10 additions & 10 deletions api/v3/examples/Address/AddressSort.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function address_get_expectedresult() {
'values' => [
'0' => [
'id' => '2',
'contact_id' => '19',
'location_type_id' => '17',
'contact_id' => '4',
'location_type_id' => '31',
'is_primary' => '1',
'is_billing' => 0,
'street_address' => 'yzy',
Expand All @@ -64,8 +64,8 @@ function address_get_expectedresult() {
],
'1' => [
'id' => '1',
'contact_id' => '19',
'location_type_id' => '17',
'contact_id' => '4',
'location_type_id' => '31',
'is_primary' => 0,
'is_billing' => 0,
'street_address' => 'Ambachtstraat 23',
Expand All @@ -89,17 +89,17 @@ function address_get_expectedresult() {
* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php
*
* You can see the outcome of the API tests at
* https://test.civicrm.org/job/CiviCRM-master-git/
* https://test.civicrm.org/job/CiviCRM-Core-Matrix/
*
* To Learn about the API read
* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
* https://docs.civicrm.org/dev/en/latest/api/
*
* Browse the api on your own site with the api explorer
* http://MYSITE.ORG/path/to/civicrm/api
* Browse the API on your own site with the API Explorer. It is in the main
* CiviCRM menu, under: Support > Development > API Explorer.
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing
* https://docs.civicrm.org/dev/en/latest/testing/
*
* API Standards documentation:
* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
*/
Loading