From 9398f16703e66ecdb319ad4fae3f9637c63d0f50 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 8 Jan 2015 17:39:48 +1300 Subject: [PATCH] CRM-15798 add appropriate tests --- tests/phpunit/api/v3/MembershipTest.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php index c3402c8e38..b164a517e1 100644 --- a/tests/phpunit/api/v3/MembershipTest.php +++ b/tests/phpunit/api/v3/MembershipTest.php @@ -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']); -- 2.25.1