From 2a610e3f2855c2854e98ede0943d750ca66b4c83 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 31 Jul 2020 16:27:55 +1200 Subject: [PATCH] Re-fix test The strtotime calculation adds 4 months before setting the day of month. However July 31 + 4 months is 1 Dec - ie the month is 12 not 11 due to there being only 30 days. So to get 27 Nov we need to get the July month (7) and add 4 and voila 11, not 12 --- tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php index 9d33072b48..4e018349cf 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php @@ -372,13 +372,14 @@ class CRM_Contribute_BAO_ContributionRecurTest extends CiviUnitTestCase { $this->validateAllCounts($membershipId1, 4); $this->validateAllCounts($membershipId2, 4); + $expectedMonth = date('m') + 4; // check membership end date. foreach ([$membershipId1, $membershipId2] as $mId) { $endDate = $this->callAPISuccessGetValue('Membership', [ 'id' => $mId, 'return' => 'end_date', ]); - $this->assertEquals(date('Y-m', strtotime('+4 months')) . '-27', $endDate, ts('End date incorrect.')); + $this->assertEquals(date('Y-' . $expectedMonth . '-27'), $endDate, ts('End date incorrect.')); } // At this moment Contact 2 is deceased, but we wait until payment is recorded in civi before marking the contact deceased. -- 2.25.1