Merge pull request #1035 from GiantRobot/CRM-12720
[civicrm-core.git] / api / v3 / examples / Membership / filterIsCurrent.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4 Demonstrates use of 'filter' active_only' param
5 */
6function membership_get_example(){
53ca8fd7 7$params = array(
8 'contact_id' => 13,
9 'filters' => array(
6a488035
TO
10 'is_current' => 1,
11 ),
12 'version' => 3,
13);
14
15 $result = civicrm_api( 'membership','get',$params );
16
17 return $result;
18}
19
20/*
21 * Function returns array of result expected from previous function
22 */
23function membership_get_expectedresult(){
24
53ca8fd7 25 $expectedResult = array(
6a488035
TO
26 'is_error' => 0,
27 'version' => 3,
28 'count' => 1,
29 'id' => 1,
53ca8fd7 30 'values' => array(
31 '1' => array(
6a488035
TO
32 'id' => '1',
33 'membership_id' => '1',
53ca8fd7 34 'contact_id' => '13',
35 'membership_contact_id' => '13',
36 'membership_type_id' => '11',
6a488035
TO
37 'join_date' => '2009-01-21',
38 'start_date' => '2009-01-21',
39 'membership_start_date' => '2009-01-21',
40 'end_date' => '2009-12-21',
41 'membership_end_date' => '2009-12-21',
42 'source' => 'Payment',
43 'membership_source' => 'Payment',
53ca8fd7 44 'status_id' => '18',
6a488035
TO
45 'is_override' => '1',
46 'is_test' => 0,
47 'member_is_test' => 0,
48 'is_pay_later' => 0,
49 'member_is_pay_later' => 0,
50 'membership_name' => 'General',
51 'relationship_name' => 'Child of',
52 ),
53 ),
54);
55
56 return $expectedResult ;
57}
58
59
60/*
61* This example has been generated from the API test suite. The test that created it is called
62*
63* testGetOnlyActive and can be found in
64* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/MembershipTest.php
65*
66* You can see the outcome of the API tests at
67* http://tests.dev.civicrm.org/trunk/results-api_v3
68*
69* To Learn about the API read
70* http://book.civicrm.org/developer/current/techniques/api/
71*
72* and review the wiki at
73* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
74*
75* Read more about testing here
76* http://wiki.civicrm.org/confluence/display/CRM/Testing
77*
78* API Standards documentation:
79* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
80*/