Merge pull request #7895 from cividesk/CRM-18130-master
[civicrm-core.git] / tests / phpunit / api / v3 / MembershipTest.php
index 25cd70d057cf7e3aa58f9cdab89d848106192d5a..868d5e2d60fc99b22c44e2627e10edd6cbba5349 100644 (file)
  * @subpackage API_Member
  */
 
-require_once 'CiviTest/CiviUnitTestCase.php';
-
 /**
  * Class api_v3_MembershipTest
+ * @group headless
  */
 class api_v3_MembershipTest extends CiviUnitTestCase {
   protected $_apiversion;
@@ -609,7 +608,7 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
     $this->contactMembershipCreate($this->_params);
     $result = $this->callAPISuccess('membership', 'get', array('return' => 'end_date'));
     foreach ($result['values'] as $membership) {
-      $this->assertEquals(array('end_date', 'membership_end_date', 'id'), array_keys($membership));
+      $this->assertEquals(array('end_date', 'id'), array_keys($membership));
     }
   }
   ///////////////// civicrm_membership_create methods
@@ -1388,4 +1387,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']));
+  }
+
 }