$smarty->assign('action', $action);
if (empty($subfile)) {
- if (file_exists('../tests/templates/documentFunction.tpl')) {
- $f = fopen("../api/v3/examples/$entity$entityAction.php", "w");
- fwrite($f, $smarty->fetch('../tests/templates/documentFunction.tpl'));
- fclose($f);
- }
+ $subfile = $entityAction;
}
- else {
- if (file_exists('../tests/templates/documentFunction.tpl')) {
- if (!is_dir("../api/v3/examples/$entity")) {
- mkdir("../api/v3/examples/$entity");
- }
- $f = fopen("../api/v3/examples/$entity/$subfile.php", "w+b");
- fwrite($f, $smarty->fetch('../tests/templates/documentFunction.tpl'));
- fclose($f);
+ if (file_exists('../tests/templates/documentFunction.tpl')) {
+ if (!is_dir("../api/v3/examples/$entity")) {
+ mkdir("../api/v3/examples/$entity");
}
+ $f = fopen("../api/v3/examples/$entity/$subfile.php", "w+b");
+ fwrite($f, $smarty->fetch('../tests/templates/documentFunction.tpl'));
+ fclose($f);
}
}
/**
* Test civicrm_activity_create() using example code
*/
- require_once 'api/v3/examples/ActivityCreate.php';
+ require_once 'api/v3/examples/Activity/Create.php';
$result = activity_create_example();
$expectedResult = activity_create_expectedresult();
$this->assertEquals($result, $expectedResult);
//make sure at least on page exists since there is a truncate in tear down
$page = $this->callAPISuccess('contribution_page', 'create', $this->_pageParams);
$this->assertAPISuccess($page);
- require_once 'api/v3/examples/ContributionCreate.php';
+ require_once 'api/v3/examples/Contribution/Create.php';
$result = contribution_create_example();
$this->assertAPISuccess($result);
$contributionId = $result['id'];
$customGroup = $this->customGroupCreate('Individual','date_test_group',3);
- require_once 'api/v3/examples/CustomFieldCreate.php';
+ require_once 'api/v3/examples/CustomField/Create.php';
$result = custom_field_create_example();
$expectedResult = custom_field_create_expectedresult();
$this->assertEquals($result,$expectedResult);
* Test civicrm_activity_create() using example code
*/
function testNoteCreateExample() {
- require_once 'api/v3/examples/NoteCreate.php';
+ require_once 'api/v3/examples/Note/Create.php';
$result = UF_match_get_example();
$expectedResult = UF_match_get_expectedresult();
$this->assertEquals($result, $expectedResult);
* Test using example code
*/
function testPaymentProcessorCreateExample() {
- require_once 'api/v3/examples/PaymentProcessorCreate.php';
+ require_once 'api/v3/examples/PaymentProcessor/Create.php';
$result = payment_processor_create_example();
$expectedResult = payment_processor_create_expectedresult();
$this->assertAPISuccess($result);
* Test using example code
*/
function testPaymentProcessorTypeCreateExample() {
- require_once 'api/v3/examples/PaymentProcessorTypeCreate.php';
+ require_once 'api/v3/examples/PaymentProcessorType/Create.php';
$result = payment_processor_type_create_example();
$expectedResult = payment_processor_type_create_expectedresult();
$this->assertAPISuccess($result);
* Test using example code
*/
function testRelationshipTypeCreateExample() {
- require_once 'api/v3/examples/RelationshipTypeCreate.php';
+ require_once 'api/v3/examples/RelationshipType/Create.php';
$result = relationship_type_create_example();
$expectedResult = relationship_type_create_expectedresult();
$this->assertAPISuccess($result);
* Test civicrm_activity_create() using example code
*/
function testUFJoinCreateExample() {
- require_once 'api/v3/examples/UFJoinCreate.php';
+ require_once 'api/v3/examples/UFJoin/Create.php';
$result = UF_join_create_example();
$expectedResult = UF_join_create_expectedresult();
$this->assertEquals($result, $expectedResult);
* Test civicrm_activity_create() using example code
*/
function testUFMatchGetExample() {
- require_once 'api/v3/examples/UFMatchGet.php';
+ require_once 'api/v3/examples/UFMatch/Get.php';
$result = UF_match_get_example();
$expectedResult = UF_match_get_expectedresult();
$this->assertEquals($result, $expectedResult);
* This example has been generated from the API test suite. The test that created it is called
*
* {$testfunction} and can be found in
-* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/{$filename}
+* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/{$filename}
*
* You can see the outcome of the API tests at
-* http://tests.dev.civicrm.org/trunk/results-api_v3
+* https://test.civicrm.org/job/CiviCRM-master-git/
*
* To Learn about the API read
-* http://book.civicrm.org/developer/current/techniques/api/
+* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
*
-* and review the wiki at
-* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
+* Browse the api on your own site with the api explorer
+* http://MYSITE.ORG/path/to/civicrm/api/explorer
*
* Read more about testing here
* http://wiki.civicrm.org/confluence/display/CRM/Testing