CRM-17289 add unite test for membership_type.getlist
authoreileenmcnaugton <eileen@fuzion.co.nz>
Tue, 29 Sep 2015 07:59:14 +0000 (20:59 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Tue, 29 Sep 2015 07:59:14 +0000 (20:59 +1300)
tests/phpunit/api/v3/MembershipTypeTest.php

index 3f859acbd6b62113774940aeae994a5c472a5e90..b251786d3b549f9edf31f7c49829b97f974721da 100644 (file)
@@ -224,4 +224,17 @@ class api_v3_MembershipTypeTest extends CiviUnitTestCase {
     $this->assertTrue(empty($newValues['relationship_direction']));
   }
 
+  /**
+   * Test that membership type getlist returns an array of enabled membership types.
+   */
+  public function testMembershipTypeGetList() {
+    $this->membershipTypeCreate();
+    $this->membershipTypeCreate(array('name' => 'cheap-skates'));
+    $this->membershipTypeCreate(array('name' => 'disabled cheap-skates', 'is_active' => 0));
+    $result = $this->callAPISuccess('MembershipType', 'getlist', array());
+    $this->assertEquals(2, $result['count']);
+    $this->assertEquals('cheap-skates', $result['values'][0]['label']);
+    $this->assertEquals('General', $result['values'][1]['label']);
+  }
+
 }