From: jitendrapurohit Date: Mon, 2 Jan 2017 06:20:06 +0000 (+0530) Subject: Fix startdate for testMembershipJoinDateFixed X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=581eb28532306f0968fd1151315fc81c92196dbf;p=civicrm-core.git Fix startdate for testMembershipJoinDateFixed --- 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; }