From 581eb28532306f0968fd1151315fc81c92196dbf Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 2 Jan 2017 11:50:06 +0530 Subject: [PATCH] Fix startdate for testMembershipJoinDateFixed --- tests/phpunit/api/v3/MembershipTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/api/v3/MembershipTest.php b/tests/phpunit/api/v3/MembershipTest.php index 47be4355b9..336e158f32 100644 --- a/tests/phpunit/api/v3/MembershipTest.php +++ b/tests/phpunit/api/v3/MembershipTest.php @@ -1154,10 +1154,15 @@ class api_v3_MembershipTest extends CiviUnitTestCase { $joinDate = date('Y-m-d'); $year = date('Y'); $startDate = date('Y-m-d', strtotime(date('Y-03-01'))); + $rollOver = TRUE; + if (strtotime($startDate) > time()) { + $rollOver = FALSE; + $startDate = date('Y-m-d', strtotime(date('Y-03-01') . '- 1 year')); + } $membershipTypeDetails = CRM_Member_BAO_MembershipType::getMembershipTypeDetails($this->_membershipTypeID2); $fixedPeriodRollover = CRM_Member_BAO_MembershipType::isDuringFixedAnnualRolloverPeriod($joinDate, $membershipTypeDetails, $year, $startDate); $y = 1; - if ($fixedPeriodRollover) { + if ($fixedPeriodRollover && $rollOver) { $y += 1; } -- 2.25.1