Merge pull request #1214 from davecivicrm/CRM-12788
[civicrm-core.git] / api / v3 / examples / RelationshipCreate.php
1 <?php
2
3 /*
4
5 */
6 function relationship_create_example(){
7 $params = array(
8 'contact_id_a' => 27,
9 'contact_id_b' => 28,
10 'relationship_type_id' => 19,
11 'start_date' => '2010-10-30',
12 'end_date' => '2010-12-30',
13 'is_active' => 1,
14 'note' => 'note',
15 'version' => 3,
16 'debug' => 0,
17 );
18
19 $result = civicrm_api( 'relationship','create',$params );
20
21 return $result;
22 }
23
24 /*
25 * Function returns array of result expected from previous function
26 */
27 function relationship_create_expectedresult(){
28
29 $expectedResult = array(
30 'is_error' => 0,
31 'version' => 3,
32 'count' => 1,
33 'id' => 1,
34 'values' => array(
35 '1' => array(
36 'id' => '1',
37 'contact_id_a' => '27',
38 'contact_id_b' => '28',
39 'relationship_type_id' => '19',
40 'start_date' => '20101030000000',
41 'end_date' => '20101230000000',
42 'is_active' => '1',
43 'description' => '',
44 'is_permission_a_b' => 0,
45 'is_permission_b_a' => 0,
46 'case_id' => '',
47 ),
48 ),
49 );
50
51 return $expectedResult ;
52 }
53
54
55 /*
56 * This example has been generated from the API test suite. The test that created it is called
57 *
58 * testRelationshipCreate and can be found in
59 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/RelationshipTest.php
60 *
61 * You can see the outcome of the API tests at
62 * http://tests.dev.civicrm.org/trunk/results-api_v3
63 *
64 * To Learn about the API read
65 * http://book.civicrm.org/developer/current/techniques/api/
66 *
67 * and review the wiki at
68 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
69 *
70 * Read more about testing here
71 * http://wiki.civicrm.org/confluence/display/CRM/Testing
72 *
73 * API Standards documentation:
74 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
75 */