CRM-15798 add appropriate tests
authorEileen McNaughton <eileen@fuzion.co.nz>
Thu, 8 Jan 2015 04:39:48 +0000 (17:39 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Thu, 29 Jan 2015 00:31:23 +0000 (13:31 +1300)
tests/phpunit/api/v3/MembershipTest.php

index c3402c8e389b8c59ee1742b27d04acbf7389924c..b164a517e1bc19ea63f5e3f0629f88fba2850547 100644 (file)
@@ -1002,7 +1002,22 @@ class api_v3_MembershipTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test that if membership start date is not set it defaults to correct end date for rolling memberships.
+   * Test that if membership start date is not set it defaults to correct end date for fixed multi year memberships.
+   */
+  public function testEmptyStartEndDateFixedMultiYear() {
+    unset($this->_params['start_date'], $this->_params['is_override'], $this->_params['end_date']);
+    $this->callAPISuccess('membership_type', 'create', array('id' => $this->_membershipTypeID2, 'duration_interval' => 5));
+    $this->_params['membership_type_id'] = $this->_membershipTypeID2;
+    $result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
+    $result = $this->callAPISuccess($this->_entity, 'getsingle', array('id' => $result['id']));
+    $this->assertEquals('2009-01-21', $result['join_date']);
+    $this->assertEquals('2008-03-01', $result['start_date']);
+    $this->assertEquals('2014-02-28', $result['end_date']);
+  }
+
+
+  /**
+   * Test that if membership start date is not set it defaults to correct end date for fixed single year memberships.
    */
   public function testEmptyStartDateRolling() {
     unset($this->_params['start_date'], $this->_params['is_override']);