From: eileenmcnaugton Date: Mon, 14 Sep 2015 00:49:12 +0000 (+1200) Subject: CRM-17075 add test to lock in membership_type_id returned for all domains X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=8b3df6dcd4851b653860ea693a4d442c6e7be581;p=civicrm-core.git CRM-17075 add test to lock in membership_type_id returned for all domains Until such time as a hook allows overriding of the domain assumptions we should not limit this by domain in advanced search (which leverages the getoptions via use of an entity reference field --- diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php index 25cd70d057..323750176b 100644 --- a/tests/phpunit/api/v3/MembershipTest.php +++ b/tests/phpunit/api/v3/MembershipTest.php @@ -1388,4 +1388,20 @@ class api_v3_MembershipTest extends CiviUnitTestCase { } + /** + * Test that all membership types are returned when getoptions is called. + * + * This test locks in current behaviour where types for all domains are returned. It should possibly be domain + * specific but that should only be done in conjunction with adding a hook to allow that to be altered as the + * multisite use case expects the master domain to be able to see all sites. + * + * See CRM-17075. + */ + public function testGetOptionsMembershipTypeID() { + $options = $this->callAPISuccess('Membership', 'getoptions', array('field' => 'membership_type_id')); + $this->assertEquals('General', array_pop($options['values'])); + $this->assertEquals('General', array_pop($options['values'])); + $this->assertEquals(NULL, array_pop($options['values'])); + } + }